[PHP] Problem with SELECT statement and reference material wanted..
Hi all! I'm having trouble retrieving a selection of my database contents. The problem is when I search for entries that exactly match a search criteria, see below: (database connection established successfully here..) $result = mysql_query("select * from complete where authorf = '$authorf'"); if ( $r = mysql_fetch_array($result) ) { echo "Found entries:"; echo ""; do { print ""; print $r["authorf"]; print ""; print $r["authorl"]; print ""; print $r["title"]; print ""; } while ($r = mysql_fetch_array($result)); echo ""; mysql_free_result($result); } Now, I know for sure that there's nothing wrong with the code within the do-loop, because if I change the SQL query to the following: $result = mysql_query("select * from complete"); ..I will get all entries from the database, nicely output to the page. (QUESTION 1) So what is wrong here? I've tried playing with the single quotation marks (') as well as using the LIKE parameter with the SELECT statement, but nothing turns out to work. See below for an example of the latter.. $result = mysql_query("select * from complete where authorf like '$authorf%'"); This returns all table entries, just as the previous example. Perhaps there is something about the '%' sign but I have no good reference available.. :-/ I also had an idea about the HTML form item names (such as text boxes) being required to be named as the column names in the MySQL table, but that failed miserably also (this is what I used in the examples below - substituting form item names doesn't change anything..) Now I'm sure that the error is a simple one, which tends to be make me even more frustrated (I¨m practically bald now from tearing my tufts of hair all night long :-) ). Thanks for any input here! (QUESTION 2) Also, another question relevant to PHP/SQL RDBMS's interfacing: Does anyoone know where I can find thorough documents on PHP commands for this purpose? Some texts which tangents database modelling and optimization would be optimal, since I'm interested in those areas also! Due to my current location in the Balkans with a crappy modem connection and a bad selection of book stores I'd prefer online texts, but any tips are welcome! Thanks in advance! Video Populares et Optimates
[PHP] doc_root question.
Hello all! I need to host several websites from the same server (physical computer), and thus require PHP to be configured for more than one directory with PHP files. Does anyone know how to specify several target directories for the doc_root directive in the configuration file? Video Populares et Optimates
Re: Re: [PHP] Problem with fopen(...) -
Well, since I'm using the latest version of the PHP plugin, it can't be that I'm using the $_FILES variable ($HTTP_POST_FILES is for older versions of php as far as I know). Nevertheless, I tried it.. and it didn't work. To clarify my problem.. I'm using a form to get a file name and some other info (regular text boxes) where the file information is supposed to be stored in the $_FILES array (predefined by php). Though it seems that I can't use neither the [name] or the [tmp_name] field in this array to get the file name. The error occurs directly when I try to fopen(...) the file. I simply get the following error: Warning: fopen("", "r") - No error in c:\code\wengine\aey.php on line 130 My MySQL db is working just fine, so is PHP (other code works), as well as the process of using other HTML form information for PHP processing (such as textboxes). Does the error message above ring a bell to you? Thanks.. Arty -Original Message- From: Pankaj Kafley <[EMAIL PROTECTED]> To: Arty <[EMAIL PROTECTED]> Date: Fri, 5 Nov 2004 23:04:24 +0100 Subject: Re: [PHP] Problem with fopen(...) - "No error"?? Can you be more specific ? I actually had the same sort of problem once but maybe it is not the same. But anyways I was getting null everytime until I change $_FILES variable to $HTTP_POST_FILES. As by suggested by someone else here. Regards On Fri, 5 Nov 2004 21:08:17 +0100, Arty <[EMAIL PROTECTED]> wrote: > I'm working against a table without problems, that is, as long as I insert and > retrieve texts and numerical values from various fields. However, I'm also using a > table for images, but I can't upload files correctly. This is the error I get : > > Warning: fopen("", "r") - No error in c:\code\wengine\aey.php on line 130 > > Warning: fread(): supplied argument is not a valid File-Handle resource in > c:\code\wengine\aey.php on line 131 > > I have no clue what's the problem. I checked register_globals (on) but then again, > that shouldn't matter 'cause I'm using the $_FILES variable to access the file > information. Obviously, PHP thinks otherwise. It seems (from the warning "fopen("", > "r")" above), that even so, $_FILES[userfile][tmp_name] is not recognized and just > interpretated as null. I've tried $_FILES[userfile][name] also, but the same error > occurs. The second error is obviously just an effect from the first, so what am I > doing wrong here?? Any tips appreciated! > > Thanks, > Arty > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php