Jump to content

[SOLVED] php.ini


Daveyboy

Recommended Posts

This is a problem I have been trying to troubleshoot for some time. I installed Wamp and able to render .php pages, however, I cannot insert data into Mysql database. I am able to insert via the SQL console with the same query, but mysql_query does not insert into database. No mysql errors given, script completes, checked php and mysql log and nothing, errors aren't suppressed. Maybe something to do with the php.ini file? Here is the databasetest script and php.ini that I am using;

http://pastebin.ca/287214
http://pastebin.ca/287218

Any help would be apperciated.
Link to comment
https://forums.phpfreaks.com/topic/31460-solved-phpini/
Share on other sites

Try this and let us know the output.

[code=php:0]
<?php
  DEFINE ('DB_USER','root');
  DEFINE ('DB_PASSWORD','password');
  DEFINE ('DB_HOST','localhost');
  DEFINE ('DB_NAME','phptestdatabase');
  mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) OR die ('Could not connect to MySql:'. my_sql_error() );
  mysql_select_db (DB_NAME) or die ('Could not select the database:'. mysql_error());
  $query = "INSERT INTO info (firstname,lastname,age) VALUES ('jill', 'smith', '39')";
  if (mysql_query($query)) {
    echo "this should work";
  } else {
    mysql_error();
}
?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/31460-solved-phpini/#findComment-145734
Share on other sites

Strangely, nothing happens no mysql error or no "this should work", just a blank window in firefox. Made sure all services were active, tested phpinfo.php (good), checked php and mysql log files but nothing in there. This is my phpinfo;

http://pastebin.ca/288242

Link to comment
https://forums.phpfreaks.com/topic/31460-solved-phpini/#findComment-146224
Share on other sites

Try this then...

[code]
<?php
  error_reporting(E_ALL);

  DEFINE ('DB_USER','root');
  DEFINE ('DB_PASSWORD','password');
  DEFINE ('DB_HOST','localhost');
  DEFINE ('DB_NAME','phptestdatabase');
  mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) OR die ('Could not connect to MySql:'. my_sql_error() );
  mysql_select_db (DB_NAME) or die ('Could not select the database:'. mysql_error());
  $query = "INSERT INTO info (firstname,lastname,age) VALUES ('jill', 'smith', '39')";
  if (mysql_query($query)) {
    echo "this should work";
  } else {
    mysql_error();
}
?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/31460-solved-phpini/#findComment-146228
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.