Jump to content

shotos

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

shotos's Achievements

Member

Member (2/5)

0

Reputation

  1. thnks i replaced 'By' with sumtin else.
  2. hi i got this mysql query $input = "INSERT INTO category(name, By) VALUES('$category','$_SESSION[user]')"; $write = mysql_query($input,$db->link) or die(mysql_error() . " Query was: $input"); which generates this error..... You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'By) VALUES('Grain','kwasi')' at line 1 Query was: INSERT INTO category(name, By) VALUES('Grain','kwasi') problem is i dun see de error... thanks in advance
  3. Hi yall, can anyone gimme some idea about using php to generate invoices ??? links to online materials will also be appreciated as my search yielded nothing relevant. thanks in advance
  4. yes it did help alot. tanx
  5. hello, i have a table i always display but always in increasing order with respect to ID column which is also auto-incremented and the primary key. now, i want it displayed in decreasing order i.e. if mysql_num_rows=5, row 5 should be displayed first, then 4, then 3............... my idea is to first check the number of rows, then make a query for each row to be displayed begining from the mysql_num_rows value. am wondering if there isn`t a simple way to do this since with my idea above every row displayed will require read from the table. $db = &new Mysql(); $query = "select * from Element_$header"; $result = mysql_query($query,$db->link); // or die(mysql_error(), . " Query was: $result"); if(mysql_num_rows($result)) { $column_count = mysql_num_fields($result); print ("<table border= 1, align=center cellpadding=10 cellspacing=0 >\n"); print ("<tr>"); for ($column_num= 0;$column_num < $column_count; $column_num++) { $field_name = mysql_field_name($result, $column_num); $field_name = trim($field_name); $field_name = str_replace("_"," ",$field_name); print("<th align=center>$field_name</th>"); } print("</tr>\n"); while($row = mysql_fetch_row($result)) { print("<tr valign=top>"); for ($column_num=0; $column_num<$column_count; $column_num++) { if($column_num == 2) { $write = $row[$column_num]; $write = explode(" ",$write); $weekday = $write[0]; $time = $write[1]; $weekday = explode("-",$weekday); $time = explode(":",$time); print("<td align=center>$weekday[2]/$weekday[1]/$weekday[0], $time[0]:$time[1]</td>"); } else { $write = $row[$column_num]; $write = str_replace("_"," ",$write); print("<td align=center>$write</td>"); } } print("</tr>\n"); } print("</table>\n"); } else { print("<font align=center>No Entries Available at the Moment!!!</font>"); }
  6. i got it now. it was a mistake in the column name tanx
  7. Hi i have a table with several columns of which one is of type datetime. i want to output rows with a specific date say 24-08-2008. but i keep getting this error Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/kwasi/public_html/call.php on line 151 this is my code $query = "select * from Element_$header where year(date_field)='$year' and month(date_field)='$month' and day(day_field)='$day'"; $result = mysql_query($query,$db->link); if(mysql_num_rows($result))
  8. have u checked this posting? http://www.phpfreaks.com/forums/index.php/topic,213142.0.html
  9. what i meant was that u use the function time() to get the current time stamp for storage in the database. when outputting, the u use getdate() to format it the way u prefer
  10. use a time stamp to store the date. check out this site http://www.tizag.com/phpT/phpdate.php
  11. finally it worked. thanks
  12. it didn't work. this was the error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'varchar(50)' at line 1 Query was: alter table Element_Trial change babybaby varchar(50)
  13. it didn't work. this was the error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'varchar(50)' at line 1 Query was: alter table Element_Trial change babybaby varchar(50)
  14. the error is: Parse error: syntax error, unexpected T_VARIABLE in /home/kwasi/public_html/modify_update.php on line 39 the code is $column_name = $_SESSION['column_name']; $rename = 'alter table Element_'.trim($title).' change ' . $column_name $check_item . ' varchar(50)'; $update = mysql_query($rename,$db->link) or die(mysql_error() . " Query was: $rename");
  15. hi all, trying to run a mysql query and i seem to have messed up with the quotes. so i get a syntax error on the query command $rename = 'alter table Element_'.trim($title).' change ' . $column_name $check_item . ' varchar(50)'; tanx in advance
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.