[PHP-DB] mysql_connect(): Lost connection to MySQL server during query
Hello all, I am getting this error when connecting to the database through mysql_connect function. Error: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server during query I am getting this error when the db server has the high load. Please help me out to fix this error. Best Regards, Manoj Kumar SIngh
Re: [PHP-DB] Pull Down Menu with ODBC query
Thanks everyone for your help so far. The last two responses I got were great and worked. However I stuck with my original script with the small $row fix presented earlier and it works great. The only problem I see with the last two are that there is no scripting to push to the next page like I have set. Saying that here is what I currently have: "; echo ""; while($row = @odbc_fetch_array($result)) { echo "$row[sls_his_cust_id]"; } echo ""; ?> I need to know how to name the selection so I can push it to the next page using the submit button. The next page so far is as follows: I need to be able to pass the selected CUSTID on to this page so I can display all the data pertinent to that customer... also I would like to be able to use the billdate that was present earlier but am not sure how to push it through again... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Pull Down Menu with ODBC query
Try something like this: --SELECT--\n"; foreach ($menu as $m) { if ($m['sls_his_cust_id'] == $_POST['menu']) echo "{$m['sls_his_cust_id']}\n"; else echo "{$m['sls_his_cust_id']}\n"; } ?>
RE: [PHP-DB] Pull Down Menu with ODBC query
BTW I want to make sure I am doing this correctly... with that current script (edited below with your fix) will I be able to pass that selection on into a further PHP page? I do not see how without assigning a variable to it and passing it with POST... how would I go about this? -- Original message -- From: "Simcha" <[EMAIL PROTECTED]> > > odbc_fetch_array() returns an associative array, so will you need to use > $row[' sls_his_cust_id'] instead of $row[0]. > > > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Monday, August 11, 2008 10:14 PM > To: php-db@lists.php.net > Subject: [PHP-DB] Pull Down Menu with ODBC query > > I am having trouble getting this script to populate the query data into a > pull down menu. > > The SQL script works fine and displays the data with odbc_result_all but > will not put it in the menu. > > Script is as follows: > > $conn = odbc_connect("HOMES", "", ""); > $billdate = $_POST[ 'billdate' ]; > $query = ("SELECT DISTINCT sls_his_cust_id FROM sls_his where > sls_his_prchdat_alt = $billdate"); > $result = odbc_exec($conn, $query); > > echo ""; > echo ""; > while($row = @odbc_fetch_array($result)) > { > echo " VALUE=\"$row[sls_his_cust_id]\">$row[sls_his_cust_id]"; > } > echo " Results\">"; > ?> > > Any ideas? > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > No virus found in this incoming message. > Checked by AVG - http://www.avg.com > Version: 8.0.138 / Virus Database: 270.6.0/1604 - Release Date: 11/08/2008 > 05:50 > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Pull Down Menu with ODBC query
I am having trouble getting this script to populate the query data into a pull down menu. The SQL script works fine and displays the data with odbc_result_all but will not put it in the menu. Script is as follows: "; echo ""; while($row = @odbc_fetch_array($result)) { echo "$row[0]"; } echo ""; ?> Any ideas? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help to improve MySQL query
On Sat, Aug 9, 2008 at 1:32 AM, Niel Archer <[EMAIL PROTECTED]> wrote: > Hi > > You do not say how you identify the last call (there is no date/time > field for example), so a complete answer is not really possible With the "id (auto incremented int)", the last record of either table would be the largest id in a particular group. > Do not use "NOT LIKE 'Completed'", it's an inefficient way of doing "!= > 'Completed'" I'll modify that as you said. My real concern is that $theHugeListOfIncidentIds keeps growing and is used in the "Calls.id IN ($theHugeListOfIncidentIds)". Even if the $theHugeListOfIncidentIds was replaced with an actual MySQL query instead of first being processed by PHP, I think that is a bad approach (but maybe that is the solution if I only change this query and do not change/add columns or states). -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help to improve MySQL query
Use an appropriate status. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Dee Ayy wrote: > On Fri, Aug 8, 2008 at 5:25 PM, Micah Gersten <[EMAIL PROTECTED]> wrote: > >> How about "select Incidents.* from Incidents inner join Calls on >> Incidents.id=Calls.incidentid where Calls.status='Open'"? >> > ... > >> Dee Ayy wrote: >> > ... > >>> The status column never has the text "Open". >>> > ... > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help to improve MySQL query
On Fri, Aug 8, 2008 at 5:25 PM, Micah Gersten <[EMAIL PROTECTED]> wrote: > How about "select Incidents.* from Incidents inner join Calls on > Incidents.id=Calls.incidentid where Calls.status='Open'"? ... > > Dee Ayy wrote: ... >> The status column never has the text "Open". ... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php