Jump to content

grantf

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Everything posted by grantf

  1. thanks all... the problem was with one of the variable names cheers.
  2. Hi all, am trying to get an if statement to evaluate 2 isset()'s at the same time with the following code, it doesnt seem to work. Does anyone know what i am doing wrong? if(!isset($_POST['var1']) && !isset($_POST['var2']))
  3. Hi all, i now have the solution.. if(preg_match('/^[0-9 ]+$/D', $s)) ok... or if(!preg_match('/[^0-9 ]/', $s)) ok... Cheers.
  4. thanks for the reply however that does not stop other characters from being allowed. essentially only numbers and spaces are to be validated, everything else denied. thanks..
  5. Hi, i am trying to validate a field so that it contains only numbers and spaces.. this is what i have. It is denying me spaces... if(ereg('[\' " ! @ # $ % ^ : ; < > & * , . ? ( ) _ ~ ` + - = a-zA-Z]', $field)) does anyone know why it is doing this? Thanks.
  6. thanks defeated but all that does it select the last entry in the dropbox..
  7. Hi, i have a drop box in a form that is populated using a SQL query. It works well however i would like to have it so that when the page is initially loaded the drop box is blank, and not have the first entry pre-loaded. I havent been able to do this using the HTML/PHP code so my current (messy) work around is having a blank SQL record and it makes it seem as though the first record is empty.. how to write this line to accomplish this and do away with the dodgy SQL record?? <?php $link = mysql_connect( $myServer, $myUser, $myPass ); mysql_select_db( $myDB, $link ); $init=mysql_init("STOREDPROCEDURE", $link); $result = mysql_exec($init); ?> <select name="VALUE" id="VALUE"> <?php while ($row = mysql_fetch_object($result)) { echo "<option value='" . $row->name . "'>" . $row->name . "</option>"; } ?> </select>
  8. Hi, i have successfullly put together some code that writes form data to my mssql db however during testing, if the form field contains an apostrephe the query fails. how do you get around this? this is the query line i am using.. $reason = $_POST['reason']; $update = "INSERT INTO journals(reason) VALUES ('$reason')"; mssql_query($update, $link); .. the form field might contain something like this, the cat's sat on the mat this is the error.. PHP Warning: mssql_query() [function.mssql-query]: message: Incorrect syntax near 's'. (severity 15) in C:\Inetpub\wwwroot\forms\journal-send.php on line 71 PHP Warning: mssql_query() [function.mssql-query]: message: Unclosed quotation mark after the character string ');'. (severity 15) in C:\Inetpub\wwwroot\forms\journal-send.php on line 71 PHP Warning: mssql_query() [function.mssql-query]: Query failed in C:\Inetpub\wwwroot\forms\journal-send.php on line 71
  9. grantf

    Basic Query

    Thanks a lot.. sorry will post in the other section.
  10. grantf

    Basic Query

    is anything obviously wrong with this? when i run it this is the output... Result = '' <?php $link = mysql_connect("localhost","root","password"); if (!$link) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db('db1', $link); if (!$db_selected) { die ('Can\'t use db1 : ' . mysql_error()); } $name = "John Smith"; $result = mysql_query('SELECT email FROM people where name = $name'); print "Result = '$result'"; ?>
  11. Hi, not sure if your suggestion would have worked however i got it working by adding a comma at the end of the line, ie... john,sydney,australia -> john,sydney,australia, and now it works perfectly. Thanks!
  12. Hi, i am just starting out with mySQL and i am trying to load data into a new table. By following the guide this is what i have typed. LOAD DATA LOCAL INFILE 'c:\file.csv' INTO TABLE people FIELD TERMINATED BY ','; i then get this as a responce Query OK, 5 rows affected (0.02 sec) Records: 5 Deleted: 0 Skipped: 0 Warnings: 0 then... when i SELECT * from people; the first field out of 3 fields is missing characters, see below +--------+-----------+------------+ | name | city | country | +--------+-----------+------------+ | ohn | sydney | australia | er | melbourne | america | | adelaide | england | | perth | spain | e | brisbane | italy +--------+-----------+------------+ 5 rows in set (0.00 sec) this is a copy of the orignal data john,sydney,australia peter,melbourne,america bob,adelaide,england alex,perth,spain george,brisbane,italy the source file is very basic, created in excel and saves as csv file, double checked in notepad++ Does anyone know what i am doing wrong??
  13. Would just like to let you know everything seems to be working ok after installing from the binary installation file. Have compared settings before and after and cant figure it out. oh well. thanks anyways!
  14. Hi, i have recently attempted to setup PHP with IISv6.0 and have run into some problems after installation. Basically, no PHP code seems to work. I'm fairly new to PHP but do have some understanding of how it works. Here is my setup and what i have done. Whenever i try to run any PHP, even the most basic script such as hello world fails with this error message; [CGI Error, The specified CGI application misbehaved by not returning a complete set of HTTP headers.] My software / hardware PHP (Manual Installation) 5.2.5 zip package Windows server 2003 R2, SP2 IIS 6.0 AMD Athlon 64 X2 Dual Firefox & Internet Explorer php-recommended.ini (renamed of course) My installation Files have been placed in C:\PHP PATH has been modified to include c:\PHP NTFS security on c:\PHP is EVERYONE = FULL CONTROL, nothing else IIS root is located at c:\inetpub\wwwroot Web Service Extensions include c:\PHP\php-cgi.exe [ALLOWED] Under the default website under home directory tab 1. Read access, log visits, index this resource 2. Execute permissions = scripts only 3. Configuration... Application extentions contain c:\PHP\php-cgi.exe (.php) [ALL VERBS] PHP.ini doc_root = "c:\inetpub\wwwroot" extension_dir = "c:\PHP\ext" cgi.rfc2616_headers = 1 I have also tried accessing the pages through these 2 methods //computer/folder/index.php http://localhost/folder/index.php This is an example of code that is failing. It doesnt get any more basic than this... <?php Print "Hello, World!"; ?> I'm not really sure what to do from here, searching for the error message on google has given me absolutely nothing and i've tried to follow the install.txt manual to the letter. Pulling my hair out - any help would be greatly appreciated!!
×
×
  • 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.