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 #179247 is a reply to message #179246] Tue, 25 September 2012 23:48 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 9/25/2012 7:19 PM, Denis McMahon wrote:
> 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
>

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.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[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: Thu Sep 19 23:55:06 GMT 2024

Total time taken to generate the page: 0.04992 seconds