Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #7175

Re: Multiple <a> Tags, Filled With MySQL DB data with PHP

From Denis McMahon <denismfmcmahon@gmail.com>
Newsgroups comp.lang.php
Subject Re: Multiple <a> Tags, Filled With MySQL DB data with PHP
Date 2012-09-25 23:19 +0000
Organization A noiseless patient Spider
Message-ID <k3te6p$inm$1@dont-email.me> (permalink)
References <e9cd6d56-2c2a-422b-af7c-f6abb198d441@googlegroups.com> <k3stt1$5ba$1@dont-email.me> <dc2ece11-7acb-4d9b-9d97-15744eb5df28@googlegroups.com> <qqf9j9-fbj.ln1@luuk.invalid.lan>

Show all headers | View raw


On Tue, 25 Sep 2012 22:12:43 +0200, Luuk wrote:

> On 25-09-2012 21:58, tom.rankin51@googlemail.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

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Multiple <a> Tags, Filled With MySQL DB data with PHP tom.rankin51@googlemail.com - 2012-09-25 10:43 -0700
  Re: Multiple <a> Tags, Filled With MySQL DB data with PHP Jerry Stuckle <jstucklex@attglobal.net> - 2012-09-25 14:21 -0400
    Re: Multiple <a> Tags, Filled With MySQL DB data with PHP tom.rankin51@googlemail.com - 2012-09-25 11:26 -0700
      Re: Multiple <a> Tags, Filled With MySQL DB data with PHP Jerry Stuckle <jstucklex@attglobal.net> - 2012-09-25 16:02 -0400
  Re: Multiple <a> Tags, Filled With MySQL DB data with PHP Denis McMahon <denismfmcmahon@gmail.com> - 2012-09-25 18:41 +0000
    Re: Multiple <a> Tags, Filled With MySQL DB data with PHP tom.rankin51@googlemail.com - 2012-09-25 12:16 -0700
    Re: Multiple <a> Tags, Filled With MySQL DB data with PHP tom.rankin51@googlemail.com - 2012-09-25 12:58 -0700
      Re: Multiple <a> Tags, Filled With MySQL DB data with PHP Luuk <luuk@invalid.lan> - 2012-09-25 22:12 +0200
        Re: Multiple <a> Tags, Filled With MySQL DB data with PHP tom.rankin51@googlemail.com - 2012-09-25 13:38 -0700
          Re: Multiple <a> Tags, Filled With MySQL DB data with PHP tom.rankin51@googlemail.com - 2012-09-25 13:53 -0700
        Re: Multiple <a> Tags, Filled With MySQL DB data with PHP Denis McMahon <denismfmcmahon@gmail.com> - 2012-09-25 23:19 +0000
          Re: Multiple <a> Tags, Filled With MySQL DB data with PHP Jerry Stuckle <jstucklex@attglobal.net> - 2012-09-25 19:48 -0400
            Re: Multiple <a> Tags, Filled With MySQL DB data with PHP Denis McMahon <denismfmcmahon@gmail.com> - 2012-09-26 14:25 +0000
  Re: Multiple <a> Tags, Filled With MySQL DB data with PHP tom.rankin51@googlemail.com - 2012-09-25 12:10 -0700
  Re: Multiple <a> Tags, Filled With MySQL DB data with PHP Christoph Becker <cmbecker69@gmx.de> - 2012-09-26 00:27 +0200
    Re: Multiple <a> Tags, Filled With MySQL DB data with PHP Jerry Stuckle <jstucklex@attglobal.net> - 2012-09-25 19:18 -0400
      Re: Multiple <a> Tags, Filled With MySQL DB data with PHP Christoph Becker <cmbecker69@gmx.de> - 2012-09-26 02:04 +0200
        Re: Multiple <a> Tags, Filled With MySQL DB data with PHP Jerry Stuckle <jstucklex@attglobal.net> - 2012-09-25 21:45 -0400
          Re: Multiple <a> Tags, Filled With MySQL DB data with PHP tom.rankin51@googlemail.com - 2012-09-25 23:16 -0700
            Re: Multiple <a> Tags, Filled With MySQL DB data with PHP tom.rankin51@googlemail.com - 2012-09-26 01:39 -0700
              Re: Multiple <a> Tags, Filled With MySQL DB data with PHP Jerry Stuckle <jstucklex@attglobal.net> - 2012-09-26 07:48 -0400
              Re: Multiple <a> Tags, Filled With MySQL DB data with PHP Christoph Becker <cmbecker69@gmx.de> - 2012-09-26 14:12 +0200
            Re: Multiple <a> Tags, Filled With MySQL DB data with PHP Jerry Stuckle <jstucklex@attglobal.net> - 2012-09-26 06:53 -0400
          Re: Multiple <a> Tags, Filled With MySQL DB data with PHP Captain Paralytic <paul_lautman@yahoo.com> - 2012-09-26 05:16 -0700
  Re: Multiple <a> Tags, Filled With MySQL DB data with PHP tom.rankin51@googlemail.com - 2012-09-26 13:35 -0700

csiph-web