Jump to content

MYSQL&PHP help, how to?


dcgamers

Recommended Posts

try this :
[code]
$query = "SELECT * from $db_table ORDER by $some_field DESC"; // don't have a LIMIT in it
$select_query = mysql_query($query, $link)
   or die("Couldn't select from $db_table ".mysql_error() );
$num_rows = mysql_num_rows($select_query); // gets number of rows
[/code]
Link to comment
https://forums.phpfreaks.com/topic/7260-mysqlphp-help-how-to/#findComment-26440
Share on other sites

Thanks it worked.
Hey I'm a c++ guy not a php guy :).
I have one more question and it is about Mysql_query and displaying in a loop, the contents of a database table. I need to know how to be able to click on a link in the loop (per looped item that is) and make it take me to a page where there will be more data for that specific item. Sorry this may be confusing, I don't know the right term names.
Link to comment
https://forums.phpfreaks.com/topic/7260-mysqlphp-help-how-to/#findComment-26454
Share on other sites

[!--quoteo(post=364269:date=Apr 13 2006, 02:39 PM:name=dcgamers)--][div class=\'quotetop\']QUOTE(dcgamers @ Apr 13 2006, 02:39 PM) [snapback]364269[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Thanks it worked.
Hey I'm a c++ guy not a php guy :).
I have one more question and it is about Mysql_query and displaying in a loop, the contents of a database table. I need to know how to be able to click on a link in the loop (per looped item that is) and make it take me to a page where there will be more data for that specific item. Sorry this may be confusing, I don't know the right term names.
[/quote]

Just use a one row table and echo the values from your query you want, but before the able put this line of code:

[code]<?php do { ?>[/code]

And after the table put the code:

[code]<?php } while ($row_NAME-OF-QUERY = mysql_fetch_assoc($NAME-OF-QUERY )); ?>[/code]

In the table put a link to another page something like this:

[code]<a href="otherpage.php?ID=<?php echo $row_NAME-OF-QUERY['IDFEILD'];?>">More Info</a>[/code]

On your second page make a query that is filtered by the URL Paramater ID and use the ID feild

Hope that all makes sense, not good at explaining
Link to comment
https://forums.phpfreaks.com/topic/7260-mysqlphp-help-how-to/#findComment-26468
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.