bwcc
Members-
Posts
23 -
Joined
-
Last visited
Profile Information
-
Gender
Not Telling
bwcc's Achievements
Newbie (1/5)
0
Reputation
-
I did figure out that it is something related to the css style of float:left; The original code above uses a style sheet that sets the data class as 'float:left;' Once I remove that (or the css link), it works fine. But to why?????
-
I am having an issue recently with IE (v7.0.5730.11) displaying more than 500 records from an SQL query. The browser seems to constantly execute - displaying and rehiding records (and the vertical scrollbar grows and shrinks). I have let the page go for about 5 minutes and it will continue this behavior until a user clicks on the webpage a second time. I've tried connecting to multiple databases, different webservers, different computers. Here's the code (stripped down version) <? $server="someserver"; $username="someuser"; $password="somepwd"; $sqlconnect=mssql_connect($server, $username, $password); $sqldb=mssql_select_db("sometable",$sqlconnect); ?> <html> <head> <title>Parking Control : Reports</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="lpac.css" rel="stylesheet" type="text/css" /> </head> <body> <? $rep=mssql_query("SELECT TOP 1500 account FROM entries"); ?> <div> <span class="title" style="width:70px;"><a href="reports_print.php?o=1&<?=''.$v.''; ?>" title="Sort by Ticket #">Ticket#</a></span> <span class="title" style="width:75px;"><a href="reports_print.php?o=2&<?=''.$v.''; ?>" title="Sort by Date">Date</a></span> <span class="title" style="width:65px;"><a href="reports_print.php?o=3&<?=''.$v.''; ?>" title="Sort by Paid or Void">Paid/Void</a></span> </div> <div> <? for($i=0; $i<1500; $i++) { $row = mssql_fetch_array($rep); echo ' <div style="clear:both;"> <span class="data" style="width:70px;">'.$row['account'].'</span> </div>'; } // end while ?> </div> </body> </html> I've also changed the for statement to a while statement. Same results. Firefox seems to execute the code normally, as IE used to. Any ideas to this strange behavior?
-
Update - The insert command in Query Analyser also gives the same error. But an Update command works just fine.
-
My first guess would be that the form has changed that specifies the "User Name" field. Check the form and make sure the text field is still named "User Name" - keep in mind that it is also case sensitive.
-
I've been working on a front-end to a database for a while now. There are 2 databases - dou_staff and mso. In the mso dbase, I recently created a new table called mso_tasks. I've used SELECT statements on that dbase w/o problems so far. A new page reads: <? $id=$_GET['id']; $server="********"; $username="*********"; $password="**********"; $sqlconnect=mssql_connect($server, $username, $password); $sqldb=mssql_select_db("mso",$sqlconnect); if (isset($_POST['submit'])) { mssql_query("INSERT INTO mso_tasks ('step_id', 'cdate', 'sdate', 'ddate', 'email', 'complete') VALUES ('{$_POST['step_id']}', '{$_POST['cdate']}', '{$_POST['sdate']}', '{$_POST['ddate']}', '{$_POST['email']}', '{$_POST['complete']}')"); }else{ $row=mssql_fetch_array(mssql_query("SELECT * FROM mso_steps WHERE id='".$id."'")); mssql_select_db("dou_staff",$sqlconnect); $rowstaff=mssql_fetch_array(mssql_query("SELECT * FROM staff WHERE id='".$row['staff_id']."'")); ?> ....more code..... The UPDATE statement is yielding the Invalid object name Warning: mssql_query() [function.mssql-query]: message: Invalid object name 'mso_tasks'. (severity 16) in task_assign.php on line 7 If I put a simple SELECT statement before the UPDATE statement, the SELECT statement runs fine and returns the query result. I checked the permissions for the username and it's the same for all of the other tables as well. I have also tried using <database>.<user>.<table> format, with the same result. This is perplexing me - any insight would be appreciated!
-
Ended up changing it from mssql_connect to odbc_connect and it works now.
-
Just looking at your script, $subemail and $subemail2 haven't been declared before your if statements.
-
The following code works perfectly in a browser: $server="xxxxxx"; $username="xxxxxx"; $password="xxxxxx"; $sqlconnect=mssql_connect($server, $username, $password); $sqldb=mssql_select_db("msdatatest",$sqlconnect); $date = mssql_fetch_array(mssql_query("SELECT CONVERT(VARCHAR(10), GETDATE(), 101) AS [MM/DD/YYYY]")); $sql=mssql_query("SELECT WOnumber, Created, Property, UDF1 FROM tbl WHERE Completed > (SELECT DATEADD(day, 0, (SELECT CONVERT(VARCHAR(10), GETDATE(), 101) AS [MM/DD/YYYY]))) AND Status='Completed'"); require("class.phpmailer.php"); while ($row=mssql_fetch_array($sql)){ ................. } However, I'm wanting to schedule this script. When using the command line executable, I get: C:\web\mmweb>c:\php\php.exe xxxxxx.php Warning: mssql_connect(): Unable to connect to server: xxxxxx in C:\web\ mmweb\xxxxxx.php on line 5 Warning: mssql_select_db(): supplied argument is not a valid MS SQL-Link resourc e in C:\web\mmweb\xxxxxx.php on line 6 This SQL server is remote to the PHP webserver. Any help on this would be appreciated.
-
You will be unable to enter anything into an indexed auto-increment column. You could remove the auto-increment property and have your code provide the info for that column. You could also add a new column based off of that auto-incremented column and have your code add the alpha prefix.
-
line 2 - missing closing " line 4 - mysql_num_rows
-
Ah - yes, I do have that restricted. This part has been back-burnered right now, but I'll remember to do that. Thanks!
-
You can run two query strings or use a nested query. The nested query is below, then the two query strings below that. Nested: <? // Your connection string mysql_select_db("DATABASE", $con); mysql_query("UPDATE data SET Column_name = 'Value' WHERE column_name = (SELECT some_column FROM some_table LIMIT 1)"); mysql_close($con); ?> 2 queries: <? // Your connection string mysql_select_db("DATABASE", $con); $row=mysql_fetch_array(mysql_query("SELECT some_column FROM some_table WHERE some_condition LIMIT 1")); $query=mysql_query("UPDATE data SET Column_name = 'Value' WHERE column_name = ' ".$row['some_column']." ' "); mysql_close($con); ?>
-
This should do what you're looking for SELECT ((AVG(`COL1`) + AVG(`COL2`)) / 2) FROM `TABLE`
-
Currently, this is my join: SELECT * FROM mso_record LEFT JOIN mso_problem ON mso_record.tracking=mso_problem.tracking ORDER BY 1 DESC This will pick all of mso_record and match them with all records in mso_problem where tracking is the same. I am wanting to change that to where it only picks the first record in mso_problem where tracking is the same. Any ideas? TIA
-
Here's something I used in the past. The form below has 5 entries. <form action="" method="post"> <? $j=0; while ($j < 5) { echo ' <div class="data" style="width:130px;"><input type="text" name="account'.$j.'" size="15" maxlength="14"></div> <div class="data" style="width:150px;"><input type="text" name="project'.$j.'" size="20" maxlength="6"></div> <br style="clear:both;" /> '; $j = $j+1; } // end while </form> ?> This way, I end up with 10 form names - account1 thru account5 and project1 thru project5 Then, the query to write to the database ends up being: for ($i=0; $i < 5; $i++) { if ( $_POST['account'.$i.''] != '' ){ ${"r_sub".$i}=@mysql_query(" INSERT INTO entries (id, account, project) VALUES (NULL, '{$_POST['cityaccount'.$i.'']}', '{${'project'.$i}}') "); } } which will send up to 5 rows to the database if the account field is not blank Hope that helps