Re: [PHP-DB] PHP_SELF and parse error
Try using $_SERVER[PHP_SELF] instead of $PHP_SELF. I believe $PHP_SELF is only set on servers with register variables turned on. ChrisPW - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, February 10, 2004 12:49 AM Subject: [PHP-DB] PHP_SELF and parse error Dear friends, I tried to modify submit if elseif statement. That didn't work.I have pasted code of form and output with error. Any comments on erros, please. Asif -- --- Notice: Undefined variable: submit in C:\webroot\display.php on line 16 Notice: Undefined variable: PHP_SELF in C:\webroot\display.php on line 19 1 Treatment of Hypertension a)loop diuritics b)clonazepam c)benzodizap d)lorazepam 2 Thrombolytic treatment of Myocardial infarction a)streptokinase b)diltiazm c)aspirin d)heparin -- - //code for above output and error HTMLbody bgcolor=?php // open the connection $conn = mysql_connect(localhost, , ); // pick the database to use mysql_select_db(testDB,$conn); // create the SQL statement $sql = SELECT * FROM testTable; // execute the SQL statement $result = mysql_query($sql, $conn) or die(mysql_error()); //go through each row in the result set and display data if (!$submit) { echo form method=post action=$PHP_SELF; echo table border=0; while ($newArray = mysql_fetch_array($result)) { // give a name to the fields $id = $newArray['id']; $testField = $newArray['testField']; $testFielda = $newArray['testFielda']; $testFieldb = $newArray['testFieldb']; $testFieldc = $newArray['testFieldc']; $testFieldd = $newArray['testFieldd']; //echo the results onscreen echo trtd colspan=4brb$id/b/td/tr; echo TD$testFieldinput type=hidden name=$testField value=\$testField\ br /td/tr TDa)input type=radio name=$testFielda value=\$testFielda\$testFielda/td/tr TDb)input type=radio name=$testFieldb value=\$testFieldb\$testFieldb/td/tr TDc)input type=radio name=$testFieldc value=\$testFieldc\$testFieldc/td/tr TDd)input type=radio name=$testFieldd value=\$testFieldd\$testFieldd/td/tr; } echo /table; echo input type='submit' value='See how you did' name='submit'; echo /form; } elseif ($submit) ? /html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Cookies ?
Try using $_COOKIE['cookie_name'] - Original Message - From: Omelin Morelos [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, February 10, 2004 12:55 AM Subject: [PHP-DB] Cookies ? Friends Is there a way to read a cookie's with php , that were generated with javascript ? I am now usign : $xidp=$_COOKIE; print Xidp $xidp; Thank you for your help in advanced. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mssql_bind problems
I am running PHP 4.3.2 and MS-SQL 2000. I am trying to run some sample code to make sure all works well. The code below works fine. It simply inserts a record into a table. This is done in the stored procedure code on the SQL server. Code that works: $myServer = 192.168.200.28; $myUser = sa; $myPass = xx; $myDB = Northwind; $s = @mssql_connect($myServer, $myUser, $myPass) or die(Couldn't connect to SQL Server on $myServer); $d = @mssql_select_db($myDB, $s) or die(Couldn't open database $myDB); $query = mssql_init(sp_addnewshipper, $s); $result = mssql_execute($query); However, when I try to pass a variable via the following code, I get an error from my proxy server saying Zero sized reply. The problem seems to be with the mssql_bind line. Code that doesn't work: $myServer = 192.168.200.28; $myUser = sa; $myPass = xx; $myDB = Northwind; $s = @mssql_connect($myServer, $myUser, $myPass) or die(Couldn't connect to SQL Server on $myServer); $d = @mssql_select_db($myDB, $s) or die(Couldn't open database $myDB); $query = mssql_init(sp_getprod, $s); $supid = 2; mssql_bind($query, @supplierid, $supid, SQLINT2,true); $result = mssql_execute($query); $numProds = mssql_num_rows($result); echo h1 . $numProds . Product; while($row = mssql_fetch_array($result)) { echo li.$row[0].li; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Problem loading images into MySQL
I'm having big problems getting PHP to load images into a MySQL database. I can and have loaded images perfectly via other routes but when I try to do it via PHP the data always ends up corrupted. I don't get any errors but the binary data is always knackered. I'm using PHP 4.3.0/Apache 2.0.43 on Windows 2000 and MySQL 4.0.7-gamma (also tested with MySQL 3.X) running on a linux box. The upload and post max settings in PHP are both set at 20mb and the size limit to MySQL is also at 20mb. As I said I can load the same files into the database via other routes without problems. The code I'm using is as follows, any ideas what the problem is? session_start(); MYSQL_CONNECT(192.168.1.10,loginname,password) or die('Unable to open database'); mysql_select_db(ImageDB) or die('Unable to select database'); $data = addslashes(fread(fopen($_FILES['UpImg']['tmp_name'], r), filesize($_FILES['UpImg']['tmp_name']))); $Qry=INSERT INTO Images (ID,Image,mime,size,OrgName) VALUES (.$_SESSION['SessID'].,\$data\,\.$_FILES['UpImg']['type'].\,.$_FILE S['UpImg']['size'].,\.$_FILES['UpImg']['name'].\); $result=MYSQL_QUERY($Qry) or die(PDB Write ErrorP.mysql_error()); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php