Jump to content

mandrill

Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://keithneilson.co.uk

Profile Information

  • Gender
    Not Telling

mandrill's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Here's my query: [code]$query_Recordset1 = "SELECT * FROM jobs WHERE JobStatus = 'Collected and paid'";[/code] Here's the error I get: [code]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1[/code] I can't see anything wrong with the SQL syntax and reckon its something to do with having ' and " right next to each other. Can anyone shed some light?
  2. I went through the code with a fine toothed comb and found this: [code]$insertSQL = sprintf("INSERT INTO customers (CustomerNumber, Title, Address, Surname, WorkNumber, HomeNumber, MobileNumber, Notes) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",                       GetSQLValueString($custID, "text"),   GetSQLValueString($_POST['title'], "text"),                       GetSQLValueString($_POST['address'], "text"),                       GetSQLValueString($_POST['surname'], "text"),                       GetSQLValueString($_POST['worknumber'], "int"),                       GetSQLValueString($_POST['homenumber'], "int"),                       GetSQLValueString($_POST['mobilenumber'], "int"),                       GetSQLValueString($_POST['notes'], "text")); [/code] I feel like an idiot. I changed the int's to text's and now it works fine. Thanks anyway :)
  3. I'm trying to store mobile phone numbers in a database as the VARCHAR data type but they keep getting stored as 2147483647. There's no problems with landline numbers (which start with 01 in my country) but mobile numbers (07etc.) seem to be problematic. Is there anyway I can force MySQL to store it as a string rather than an integer? I've tried changing the data type (All the INTs unsigned with zerofill, VARCHAR, CHAR, all the TEXTS, and the various BLOBs) and it always stores them as 2147483647. Any advice would be most appreciated as I've been tearing my hair out over this for the last two days.
  4. I'm having the same kind of problem. I'm trying to get a list of files in a subdirectory but it keeps giving me a list of the files in the root directory as well. see [url=http://keithneilson.co.uk/kgpalpha1.php]http://keithneilson.co.uk/kgpalpha1.php[/url] for the results I only want the JPGs listed, and here's the code: [code] <?php /* Keiths Gallery Project Purpose: To dynamically list files and directories and display them as galleries on my website Step one: define variables */ $rootdir="/this/is/where/i/put/my/gallery/"; // Step two: generate array of subdirectories of the /gallery directory. These will be my galleries organised according to subject matter $dh=opendir($rootdir); //open the starting directory while ($filename = readdir($dh)) { $rootdircont[] = $filename; //put everything in the starting directory in an array } $counter = 0 ; foreach ($rootdircont as $file) { if ( is_dir($rootdir.'/'.$file)) //check each value in the array to see if it is a directory { if(($file!='..')or($file!='.')) //trying to filter out the . and .. so they are not opened but it doesn't work { $counter ++ ; $galarray[$counter] = $file; //if it is a directory put it in another array } } } /* test echo of above */ echo '</br>'; foreach ($galarray as $galdir) { echo "Echo 1: $galdir</br>"; } /* end test echo */ foreach ($galarray as $galdir) { $galdiruri="/gallery/$galdir"; // set the value of the gallery's uri if(($galdir!='..')or($galdir!='.')) // same as before but doesn't seem to be working, again { $dh=opendir($rootdir.'/'.$galdir); //open subdirectory while ($filename=readdir($dh)) { if(is_file($rootdir.'/'.$galdir.'/'.$filename)) //makes sure you only get filenames in the following array { $images[] = $filename; // transfer filenames into another array } } /*test echo list of files*/ foreach ($images as $test) { echo "Echo 2: $test</br>"; } /*foreach ($images as $imagefile) // the following prints the array as a list of links { if (is_file($rootdir.'/'.$galdir.'/'.$imagefile)) //make sure any directories aren't listed { echo"<a href=&quot;"; echo"$galdiruri"; echo"/"; echo"$imagefile"; echo"&quot;>"; echo"$imagefile"; echo"</a></br>"; } }*/ } } ?> [/code] I've tried changing all sorts of things and it doesn't seem to make much difference (though using is_file gave me better results than I had  got before, I only thought of it when I read this thread.) I'm ignoring the invalid argument for now as I think I know what's causing it. Singingcrane: If you put everything in the directory you're reading into an array then use if(is_file()) and elseif(is_dir()) that should let you specify things to do with files and things to do with directories. I could be wrong though I'm just as much of a n00b as you.
  5. bingo sasa that did it thanks :)
  6. The is-dir function isn't recognising a directory. here's the code: [code]<?php /* Keiths Gallery Project Purpose: To dynamically list files and directories and display them as galleries on my website Step one: define variables */ $rootdir="the/directory/i/want/read"; // Step two: generate array of subdirectories of the directory. These will be my galleries organised according to subject matter $dh=opendir($rootdir); while ($filename = readdir($dh)) { $rootdircont[] = $filename; } foreach($rootdircont as $image) { echo"$image"; var_dump(is_dir($image)); echo"</br>"; } echo"$</br>"; $counter = 0 ; foreach ($rootdircont as $file) { if ( is_dir($file)) { $counter ++ ; echo "$counter: $file</br>"; $galarray[$counter] = $file; } } /* test echo of above */ echo '</br>'; foreach ($galarray as $galdir) { echo "$galdir</br>"; } ?>[/code] here's the output: [code].bool(true) ..bool(true) atomfeedbtn.pngbool(false) readme.txtbool(false) 43things.pngbool(false) ap-search-go-btn.gifbool(false) arthurbool(false)      <-------------- This is a directory but its not being recognised as one. bc80x15gold.gifbool(false) blogoramabutton.gifbool(false) button_sm_1.gifbool(false) deliciousbutt.pngbool(false) firefox_80x15.pngbool(false) goblink.gifbool(false) icon_scotland_80x15.gifbool(false) index.htmlbool(false) lcabutton.pngbool(false) onepointthreebanner.jpgbool(false) popdexbtn.pngbool(false) right2writebtn.pngbool(false) rssfeedbtn.pngbool(false) scotblogsbtn.gifbool(false) Thumbs.dbbool(false) ucrated.pngbool(false) ucv12title.jpgbool(false) wika-blogbtn.pngbool(false) Cloud.pngbool(false) button6.gifbool(false) Dawn_Of_Skirmish_v1.6_AI_Mod_Install.exebool(false) egobutton.pngbool(false) searchbox-logo-126x32.gifbool(false) zardozzbtn.pngbool(false) logo_80x15.gifbool(false) libertybutt.pngbool(false) wp-logos-buttons.jpgbool(false) wp-button-3.pngbool(false) tn-tiny.gifbool(false) $ 1: .[/code] Its probably something really stupid but I'd appreciate it if someone could point it out to me, cos I've been staring at it for hours and getting nowhere. thanks
×
×
  • 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.