Hi there, I'm working on a piece of my website that reads info from the database, and displays it. It works great. So now I want to see what happens when a database connection error occurs, so I stop the mysql service. What happens, is a message is printed to the screen saying it can't connect (auto mysql message), but my entire php script stops parsing. \n\nHow can I get it to keep going, just not display the database results?\n\nThanks.
131001
Capture and test the return value from mysql_connect(). If it's not FALSE, it contains your DB resource. If it FALSE, do some other processing. e.g.\n\nif( mysql_connect( whatever ) )\n{\n  do something;\n}\nelse\n{\n  do something else;\n}\n\n// or more commonly:\n\nif( ! mysql_connect( whatever ) )\n{\n  do error processing;\n}\nelse\n{\n  do normal processing;\n}\n\nNote that you should disable error displays on production servers in your php.ini file. (Errors will still appear in you apache error log.) e.g.\n#php.ini\n...\ndisplay_errors = Off\n\nAlternatively, you can use this function from your code:\n\nerror_reporting(0);
323754
I will be able to help u more if u could tell me the excate descrition of error message.\n\nAny way if u want to avoid that to continue ur work then \n\nGo to tools menu--> internet options-->Advanced--> and uncheck the "Display a notificationabout every script error"\n\nHope this would work
347697
have u started programming? if not try to do it for ur self, but still if u have errors post ur code here, then can try to debug it for u..but cant simply write a full program just like that. sorry!
284339
You can use PHP and read/write to a MySQL Database.\n\nHere is one good tutorial:\nhttp://webmonkey.wired.com/webmonkey/programming/php/tutorials/tutorial4.html\n\nIf you need additional help you can email me,\neoffice4u@gmail.com
48473
I found this on the Google Desktop website:\n\n-------------------------------------------------------\nI see a "Problem connecting to the local server" error.\n\nIf you see this error:\n\n"Google Desktop has detected a problem connecting to the local Google Desktop server on your machine. . . ."\n\nit may have been displayed by mistake. Please visit the Google Desktop homepage and try searching. If there's no problem, you can ignore the error.\n\nIf the search doesn't work or you can't access Google Desktop, you may need to adjust your proxy settings. Please see http://desktop.google.com/support/bin/answer.py?answer=12229 for more information.\n----------------------------------------------------------
285568
this is because the websites are programmed wrong. go to tools / internet options / advanced / tick 'disable script debugging', and you wont get these error messages again
760
Hello,\n\nLooks like you need to add a 0 to the end of the rating_sum row and the script will execute. So edit the mambo.sql file located in the SQL folder by adding a 0 at the end of the rating_sum row see below:\n\n`rating_sum` int(11) unsigned NOT NULL default '',\n\nto \n\n`rating_sum` int(11) unsigned NOT NULL default '0',\n\nI think your local MySQL install is being picky. \n\nTry it out and let me know, if that works. \n\nThanks,\n\nV
404762
Maybe the server is down. Try again another time, or call the service employees to let them try to help you with your situation.
452868
You have to enable Sybase support when you (re)configure PHP.  Use the option --with-sybase-ct[=DIR] at the command line.\n\nFor a list of sybase funcitons PHP has built in check out the source.\n\nit all starts with a sybase_connect("serveraddress","user","password");
123820
A good tips from a programmer try PHP manual, i find it very helpful when i want to know something and don't jump over the comments if they are avilable...
670988
Er, okay...\n\nThere are a couple of things that could do it.\nFirst off, I don't think that after inclusion, you can use any other header commands (I don't know why). Here are some things you can do.\n\n1: You can create another include file to do the headers, so your code looks like this.\n\n---start.php---\n<?php\nsession_start();\ninclude ("mysqlconnect.inc");\nif (asdasd) include ('redir.inc');\n?>\n---redir.inc---\n<?php\nheader("Location: http://asdadsdd");\n?>\n---\n\n2: You can remove the entire mysqlconnect.inc file and paste it into the other file, but I wouldn't.\n\n3: You could add into mysqlconnect.inc a command to redirect, so it looks like this\n\n---mysqlconnect.inc---\n<?php\nfunction connect() {\n...\n}\nfunction query($query){\n...\n}\nfunction redir($location) {\nheader("Location: $location");\n}?>\n---start.php---\n<?php\nsession_start();\ninclude ("mysqlconnect.inc");\nif (asdasd) {\n$location = "http://asdadsdd";\nredir ($location);\n}\n---\n\nWhichever way works for you.
348589
Its going to be difficult without an understanding of some basic programming. You mentioned a MySQL editor, im hoping that this is phpmyadmin, this is what I have used to create databases before. Based on what it sounds like your needs are, you might like to try find a student studying this,and ask for his/her help. The are usually itching to get their hands on something to work with. More professional services are available from sites like rentacoder (rent a coder) - google that - Alternatively look around for some basic connection string tutorials wiht mysql and php, im sure with a little tinkering and a lot of patience you might get it working.
390970
That information should be kept on the server and not the local machine.  So it does not matter.  Just reinstall.\n\nHope this helps and GL :-)
62107
I'm not sure if you have already installed MySQL and need help setting up the database or need help installing.  If you need help installing, check out http://groups.google.com and type in installing mysql.  You can usually find a wealth of knowledge on there.  If you have the program installed but need to setup the database, check out Webmin (http://www.webmin.com).  It is a web based application that makes setting up different aspects of a server much easier.
288993
The last time this happened to me Yahoo! Messenger folks said some kind of java problem. Nothing worked and I just switched to using Trillian :(\n\nOnly when I formatted my computer did things start working again.
379735
It means that the page has loaded but there are script errors on the page preventing it from fully loading.  If this is your page you are trying to access, run it through a code validator to find where the code error(s) is.
477036
In solution of first question you have to first check PHP configuration with Apache server. The cause of your problem is PHP is not configured properly into Apache.\n\nThe configuration of PHP 5.2 on Apache 2.2 is somewhat different then the older versions of PHP & Apache. So it's better to understatnd the steps carefully. You can refer PHP manual from PHP site.\n\nhttp://www.php.net/manual/en/\n\nIf you are a beginner for PHP & Apache then I suggest you to use Wamp Server instead of installing PHP, Apache & MySQL saperatly. Wamp Server combines Apache, MySQL & PHP and intallation is quite simple. It automatically configure Apache & PHP. Wamp Server is available free at\n\nhttp://www.wampserver.com/en/download.php\n\nIn the solution of the second question:\n\napply this code:\n\n<?php\n    $dbHost = "localhost"; // It is the host where database is installed\n    $dbUser = "root"; // It is the username which have permission to use the database\n    $dbPassword = "abcdef"; // It is the password which is set for the specified username\n    $dbName = "userinfo"; // It is the schema or database name which stores your user data\n    \n    $dbHandle = mysql_connect($dbHost, $dbUser, $dbPassword);\n    if($dbHandle = NULL)\n        die("Database connection failed");\n\n    mysql_select_db($dbName);\n\n    /* Initialise $userName here according to your login information */\n\n    $query = "SELECT user_id FROM users WHERE user_name = $userName";\n    $result = mysql_query($query);\n    $row = mysql_fetch_array($result);\n?>\n\n<HTML>\n<BODY>\n<P>User ID: <?=$row[user_id]?></P>\n</BODY></HTML>