Re: Help with php to MySql...




1) check that error reporting is enabled
2) check you don't have transactions on (you will need to commit by hand)
3) mysql_query can return a result. Capure it and analyse it
4) enable logging on the DB, and see what it gets. This often gives a clue where the query breaks

And as much as PEAR::DB can kill performance, a query like that is just begging to be automated via some kind of statement preparation. You should also pay attention to escaping quotes and such, in your fields.

/marcin

Peschtra wrote:
Hello --

I am trying to write to a a MySql database using php, and I seem to be hitting a wall.

I am attaching my php file in case someone can look at it. When I run it, I don't get any error messages and all my echoes come through but nothing is written to my database. I think I am missing something stupid. Any help would be appreciated.

Thanks,
Peter

------------------------------------------------------------------------

Processed
"; $link = mysql_connect("db377.perfora.net", "dbo165086404", "jxtJdnCJ") or die ('I cannot connect to the database because: ' . mysql_error()); echo "Connected
"; mysql_select_db(db165086404) or die('Could not select database'); echo "db Selected
"; echo "Hi
"; mysql_query("INSERT INTO 2006_eval (overall, overall_comments,difficult, difficulty_comments, homework, homework_comments, pace, pace_comments, grading_structure, grading_structure_comments, grading_fairness, grading_fairness_comments, tests, tests_comments, labs, labs_comments, questions, questions_comments, approach, approach_comments, fav_topic, fav_act, least_fav_topic, least_fav_act, extra_topic, tests_prepared, didnt_get, change, again, again_comments, general_comments, name, ip, year, math, science, grade, number) VALUES ('$overall', '$overall_comments', '$difficulty', '$difficulty_comments', '$homework', '$homework_comments', '$pace', '$pace_comments', '$grading_structure', '$grading_structure_comments', '$grading_fairness', $grading_fairness_comments', '$tests', '$tests_comments', '$labs', '$labs_comments', '$questions', '$questions_comments', '$approach', '$approach_comments', '$fav_topic', '$fav_act', '$least_fav_topic', '$least_fav_act', '$extra_topic', '$tests_prepared', '$didnt_get', '$change', '$again', '$again_comments', '$general_comments', '$name', '$ip', '$year', '$math', '$science', '$grade')"); ?> Inserted
.



Relevant Pages

  • problem passing argument from one php page to another ...
    ... database. ... But upon calling the 2nd php file when I try to use the argument ... passed it appears to have no value, for example echo $argument; ...
    (comp.lang.php)
  • Stuck on a PHP random link script
    ... Database is setup, have got it to work within a *.php page, but when I ... with the php file above. ... This (the echo one) results in the random link showing at the bottom ... Then add %%rquote1%% to the menu via the tpl template. ...
    (alt.php)
  • passing variables values using POST
    ... i am presently passing the value of a variable to a php file using GET ... after data has been inserted to the database. ... echo "error message"; ... validations using php and i have assumed that user has javascript ...
    (php.general)
  • passing variables values using POST
    ... i am presently passing the value of a variable to a php file using GET ... after data has been inserted to the database. ... echo "error message"; ... validations using php and i have assumed that user has javascript ...
    (comp.lang.php)
  • Re: [PHP] peer review (was php framework vs just php?)
    ... the database. ... Additional arguements may be supplied to indicate columns to ... echo "<input ... single quotes in the Type column of the ...
    (php.general)