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 #179246 is a reply to message #179241] Tue, 25 September 2012 23:19 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 22:12:43 +0200, Luuk wrote:

> On 25-09-2012 21:58, tom(dot)rankin51(at)googlemail(dot)com wrote:
>> I'm not too sure how to debug correctly following these instructions.
>> I can place the code at the beginning and end of my page, but I am
>> getting a syntax error when typing $result = mysqli->query($sql);
>>
>>> <?php $sql = ".......";
>>> $result = mysqli->query( $sql );
>
>>> $debugtxt .= "sql: {$sql}\n";
>
> or, that last one could be:
> echo "SQL: {$sql}\n";
>
> it should echo the query to the output......

Yeah, but when I'm trying to debug code generating a web page, I stick
all the debugging output in a <pre> element at the end of the page, if I
don't get the pre element output the problem is invariably identified in
the server error log.

To the OP - sorry, you're not using mysqli .... replace "$result = mysqli-
> exec( $sql );" with whatever code you're using to make your database
call, maybe the "mysql_query" call.

Change this php:

$visuals_query=mysql_query("SELECT id, imagelink, comment, picdate, rel
FROM PictureMedia ORDER BY picdate DESC");

To:

<?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";
?>

and then use the

<?php echo "<php>{$debug}</pre>"; ?>

to show the actual query, the query result set (warning, can be large)
and any sql error messages.

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 09 23:53:31 GMT 2024

Total time taken to generate the page: 0.04996 seconds