FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Multiple <a> Tags, Filled With MySQL DB data with PHP
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Multiple <a> Tags, Filled With MySQL DB data with PHP [message #179259 is a reply to message #179247] Wed, 26 September 2012 14:25 Go to previous messageGo to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On Tue, 25 Sep 2012 19:48:35 -0400, Jerry Stuckle wrote:

>> <?php $sql = "SELECT id, imagelink, comment, picdate, rel FROM
>> PictureMedia ORDER BY picdate DESC";
>> $visuals_query=mysql_query( $sql );
>> $debug = "sql: " $sql . "\nresult: " . var_dump( $visuals_query ) .
>> "\n"; if ( $visuals_query == false )
>> $debug .= "sql error: " . mysql_error() . "\n";
>> ?>

> Won't show much. The result of a mysql_query call is a result, not an
> array. All it will say is "false" or "resource id 2" (or similar). And
> your following "if" statement will handle the first result.

Point taken, it probably needs to be more like:

<?php
$sql = "SELECT id, imagelink, comment, picdate, rel FROM PictureMedia
ORDER BY picdate DESC";
$visuals_query = mysql_query( $sql );
$debug = "sql: " $sql . "\n";
if ( $visuals_query == false ) {
$debug .= "sql error: " . mysql_error() . "\n";
}
else {
$debug .= "Result set contained " . mysql_num_rows( $visuals_query
) ." rows\n";
if ( mysql_num_rows( $visuals_query ) > 0 ) {
$debug .= "Rows:\n"
while ( $tmp = mysql_fetch_assoc( $visuals_query ) )
$debug .= var_dump( $tmp );
mysql_data_seek( $visuals_query, 0 );
}
}
?>

Rgds

Denis McMahon
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Dynamic Links (MySQL/PHP)
Next Topic: Advice for Literature on PHP-Based Web Development Business Models
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 20:02:13 GMT 2024

Total time taken to generate the page: 0.04838 seconds