jarv Posted July 27, 2011 Share Posted July 27, 2011 $qry = "SELECT calendar_id, booking_total, booking_deposit, booking_tax, booking_status, payment_method, payment_option, customer_name, customer_email, customer_phone, customer_country, customer_city, customer_address, customer_zip, customer_notes, cc_type, cc_num, cc_exp, cc_code, txn_id, processed_on, created, appliance_make, appliance_model, appliance_serial, appliance_fault FROM aarbookts_booking_bookings WHERE id='$booking_id'"; $cur=mysql_query($qry); while($i=mysql_fetch_row($cur)) { $calendar_id=$i[0]; $booking_total=$i[1]; $booking_deposit=$i[2]; $booking_tax=$i[3]; $booking_status=$i[4]; $payment_method=$i[5]; $payment_option=$i[6]; $customer_name=$i[7]; $customer_email=$i[8]; $customer_phone=$i[9]; $customer_country=$i[10]; $customer_city=$i[11]; $customer_address=$i[12]; $customer_zip=substr($i[13], 0, strpos($i[13],' ')); $customer_notes=$i[14]; $cc_type=$i[15]; $cc_num=$i[16]; $cc_exp=$i[17]; $cc_code=$i[18]; $txn_id=$i[19]; $processed_on=$i[20]; $created=$i[21]; $appliance_make=$i[22]; $appliance_model=$i[23]; $appliance_serial=$i[24]; $appliance_fault=$i[25]; } echo '<h3>Booking made on: '.$created.'</h3>'; echo '<p><strong>Customer Notes:</strong> '.$customer_notes.'<br /><br /> <strong>Booking Status:</strong> '.$booking_status.'<br /><br /></p>'; output is: Booking made on: 2222207-26 23:50:54 Customer Notes: no Booking Status: pppppng and should be: Booking made on: 2011-07-26 23:50:54 Customer Notes: no Booking Status: pending Quote Link to comment https://forums.phpfreaks.com/topic/242946-variables-dont-show-correct-data/ Share on other sites More sharing options...
freelance84 Posted July 27, 2011 Share Posted July 27, 2011 Have you checked to see what has actually been stored in your database? It may just be incorrect there Quote Link to comment https://forums.phpfreaks.com/topic/242946-variables-dont-show-correct-data/#findComment-1247858 Share on other sites More sharing options...
AyKay47 Posted July 27, 2011 Share Posted July 27, 2011 have you tried printing your query to make sure it is doing what you expect, also when using mysql_fetch_row(), make sure you are grabbing the correct row.. what should your output be? Quote Link to comment https://forums.phpfreaks.com/topic/242946-variables-dont-show-correct-data/#findComment-1247860 Share on other sites More sharing options...
AbraCadaver Posted July 27, 2011 Share Posted July 27, 2011 Also, you'll save yourself a lot of trouble if you use associative arrays: while($i=mysql_fetch_assoc($cur)) { $calendar_id=$i['calendar_id']; //etc... } Quote Link to comment https://forums.phpfreaks.com/topic/242946-variables-dont-show-correct-data/#findComment-1247999 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.