  Ken Sohryu Darkest Days
join:2001-01-07 Chicago, IL
1 edit | reply to cdog Re: PHP MySQL while Loop
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 : 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] - |
|