This is gonna be a dumb question, but I’ve been working with this code for years and never stopped to understand the what and why….
This is a very typical query I would copy and edit:
mysql_select_db($database_db, $db);
$query_qry_details = sprintf("Select * from table where id = %s", $KTColParam1_qry_details);
$qry_details = mysql_query($query_qry_details, $db) or die(mysql_error());
$row_qry_details = mysql_fetch_assoc($qry_details);
$totalRows_qry_details = mysql_num_rows($qry_details);
What do all these rows mean?
The first I know looks up the correct database. I have this line before each query on the page….do I need this?
The second row ($query_qry_details) is the query itself. I see that.
Rows 3 and 4 – no clue…
Row 5 is obviously a count of the number rows the query returns.
Thanks in advance as always.
EDITED
Shortly:
mysql_select_db(database_name, link_identifier)– Sets the cuurent active database on server that is associated with the specified link identifier.sprintf– Return formatted string which acts as a query.mysql_queryordie– Sends a unique query to the database previously specified or exit from query.mysql_fetch_assoc– Returns an associative array that corresponds to the fetched row and moves the internal data pointer ahead.mysql_num_rows– Retrieves the number of rows from a result set.