Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,148,850 members, 7,802,724 topics. Date: Friday, 19 April 2024 at 08:03 PM |
Nairaland Forum / Science/Technology / Programming / Insert Not Working (820 Views)
How To Insert Pictures Or Images In Textedit (webdesign) / Please Help On How To Insert Smiley In An Output Text In Java Script / Insert Image Into Mysql (2) (3) (4)
Insert Not Working by ckdoublene: 7:27pm On Apr 14, 2011 |
can someone help me figure out why this code doesn't insert data into the database ? My other problem here is that I dont know how to determine a date a month in the future(duedate). It doesn't have to be concise. <?php?> |
Re: Insert Not Working by wavemaster(m): 8:52pm On Apr 19, 2011 |
TRY THIS $conn= mysql_connect('localhost', 'root', "" // oodb should be in form of "oodb" or $oodb // Use this mysql_select_db("oodb", $conn); // or this mysql_select_db($oodb, $conn); // Note: Authentication is needed to select a database. // For the SQL syntax $query = "INSERT INTO oocust VALUES ('$pd', '$payrec', '$ordernum', '$invnum', '$bname', '$bstreet', '$bstate', '$bcity', '$bzip', '$sname', '$sstreet', '$sstate', '$scity', '$szip', '$contact', '$terms', '$fob', '$shipdate', '$shipamt', '$dateord', '$datecomp', '$duedate', '$datepaid', '$qty', '$descr', '$charges', '$paidamt', '$dayslate', '$tax', '$amtdue', '$paidsum')"; // Use this $stat= mysql_query($query, $conn); if($stat) { echo 'Successful'; } else { die('Query failed: ' . mysql_error()); } // Or this mysql_query($query, $conn) or die('Query failed: ' . mysql_error()); // ========= mysql_close(); Hope this help. |
Re: Insert Not Working by wavemaster(m): 9:12pm On Apr 19, 2011 |
To determine future date and month $24hrFromNow= time()*(60*60*24); $date= date("d", $24hrFromNow); // This will return 20 $Month= date("m", $24hrFromNow); // This will return 4 $DateMonth= date("m-d", $24hrFromNow); // This will return 20-04 $DateMonthYear= date("m-d-Y", $24hrFromNow); // This will return 20-04-2011 Hope this also helps. Best regards. |
Re: Insert Not Working by kodewrita(m): 1:39pm On Apr 20, 2011 |
@Poster Just a few thoughts. seems your table is too big. you have too many fields. split into a few tables with common key and use a JOIN to retrieve when necessary. |
(1) (Reply)
How Well Do You Understand And Write Your Local Language? / Every Writer Needs A Reader(Java inclined assistance) / Download Over 5,000 Free Software Packages
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 29 |