Search:  

 
 
   All ForumsHot TopicsGallery






how-to block ads


 
Forums » Tech and Talk » OS and Software » Webmasters and Developers » PHP MySQL while Loop
Search Topic:
Share Topic:
RSS topic:
toggle:
flat / full
normal / watch
Posting:
Post a:
Post a:
Hosting Domain »
« HTML "alt" tag  
AuthorAll Replies


Ken Sohryu
Darkest Days

join:2001-01-07
Chicago, IL


1 edit
reply to cdog
Re: PHP MySQL while Loop

while_debug.zip 1,070 bytes
(while_debug.php)
The link to the source code you posted didn't work, so I had to wing it in writing up some basic error checking tools. I hope they help you out a bit.

edit: Stupid forum screwed up my beautiful code formatting, so I've attached the actual script.

// I basically threw in some basic diagnostic displays.
// Had no choice since the link to your complete source code
// wasn't working. Anyway, this should help you track down
// your problem. Hopefully.

error_reporting( E_ALL );

// GET SUPER ADMIN
$z_getsuper = mysql_query( "SELECT * FROM members WHERE mem_level = '5'" ) or die( mysql_e
*rror() );

// Loop through results.
while( $row = mysql_fetch_array( $z_getsuper ) )
{
// Comment this if() statement out or delete it when finished debugging.
if( $row['mem_id'] == 0 )
{
// Output all fields of "faulty" record for troubleshooting.
echo '<p>Error: An ID number of <strong>0</strong> was detected.</p>';

rsort( $row, SORT_NUMERIC );

$i = ( count( $row ) - 1 );

do
{
echo '<p>' . $row[$1] . '</p>';
}
while( $i-- );

die();
}

$z_super_id = $row['mem_id'];

// Construct SQL query separately. Easier to read.
$sql ="INSERT INTO mb_mod_alert SET
mb_mod_alert_receive_id = '$z_super_id',
mb_mod_alert_sender_id = '$l_id',
mb_mod_alert_preset = '$preset',
mb_mod_alert_reason = '$reason',
mb_mod_alert_msg = '$alert_msg',
mb_mod_alert_date = '$rightnow',
mb_mod_alert_status = 'new'";

// Send message to Super Admins.
$sendalertsuper = mysql_query( $sql );

// If message insertion fails, kill script and display debugging info.
// Comment out or delete when finished debugging.
if( mysql_affected_rows() <= 0 )
{
echo '<p><strong>NOTICE:</strong> Could not insert new record into database.</p>';

// If there was an SQL error, we'll display it.
if( mysql_error() )
{
echo '<p><strong>MySQL Error:</strong>' . mysql_error() . '</p>';
}

echo '<p><strong>Your SQL Query:</strong> <span style="color: #696;">' . $sql . '</span></
*p>';

die();
}
}

(*) WARNING 2 long line(s) split

--
» I am surrendering to the Gravity and the unknown.

» Catch me, heal me, lift me back up to the sun.

» I choose to live.

A Perfect Circle - Gravity


justin
Australian
join:1999-05-28
Brooklyn, NY
Ths stupd forum was protecting us all from your long lines blowing the right margin, if you kept them to 80 columns or less, it would look just as you wanted it to.


cdog
Boo
Premium
join:2001-10-11
Chicago, IL
clubs:

said by justin See Profile:
Ths stupd forum was protecting us all from your long lines blowing the right margin, if you kept them to 80 columns or less, it would look just as you wanted it to.

ahhhh ok

p.s. I got it to work... thanks guys appreciate it
--
If what ya got is perfect and you always want better. Happiness will never come. - [Have Some Fun] -
Forums » Tech and Talk » OS and Software » Webmasters and DevelopersHosting Domain »
« HTML "alt" tag  


Friday, 27-Nov 21:23:59 Terms of Use | Privacy Policy | Hosting by www.nac.net - DSL,Hosting & Co-lo | feedback | contact
over 10 years online! © 1999-2009 dslreports.com.
page compression OFF
Most commented news this week
· [121] Time Warner Cable Fires Broadside At Broadcasters
· [112] New AT&T Ad Campaign Hits Back At Verizon
· [95] Apple Joins AT&T Verizon Snark Fest
· [87] New Bill Takes Aim At Higher Verizon ETFs
· [70] TiVo Sees Record Customer Losses
· [68] In-Flight Internet Headed For Bumpy Landing?
· [61] Verizon CEO: Hulu Will Be Dead Soon
· [60] Thanksgiving Open Thread
· [38] EFF Wages War On Fine Print
· [38] ICANN Slams DNS Redirection
Most people now reading
· Windows 7 boot manager editing questions [Microsoft Help]
· 3.x Feral Druid - Bear Tanking Guide [World of Warcraft]
· Backstab vs screws (not which to use) [Home Repair & Improvement]
· [ PVP] 3.2 DK PvP D/W Spec... [World of Warcraft]
· HOW-TO: QoS and Tomato (fixes "choppy voice") [MagicJack]
· Blue Ray: Samsung BD-P3600 or LG BD390 [Audio/Video Chat]
· [ Classes] Druid tanking: rotation and glyphs [World of Warcraft]
· Newegg Black Friday Sale started [Users Find Hot Deals]
· [How to] Install Asterisk on an Asus WL-520GU router [VOIP Tech Chat]
· Only firefox accesses Internet? [Security]