RE: [PHP-DB] Anti-virus alarm! Sulfbnk var inget virus.
Beklager forrige epost, det viser seg at jeg og en god del andre har blitt lurt. Her er en webside som forklarer hvordan du reparerer feilen: http://netsquirrel.com/msconfig/sulf.html Filen sulfnbk.exe er en fil som gjenoppretter lange filnavn. English: Sorry for the last email, it seems, this file sulfnbk.exe only restores long filenames. Here's a link to a page that explains how you can restore the file. http://netsquirrel.com/msconfig/sulf.html Buahahahaboy do I smell a troll. Innovative way to spam a list with an advertisement I must say. Better be careful though, piss the wrong person off with a scam like this and you could have a lawsuit on your hands. Sincerely, Craig Vincent -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Wildcards
Hi, I am trying to make a SELECT command like this: $qid =db_query( SELECT ID, NAME, ADDRESS FROM users WHERE ID=* AND NAME='John' ); Is it somehow possible to have a wildcard, so it returns all records, where the name is john and the ID is not important? Well for a query like that just omit ID= $qid = db_query(SELECT ID, NAME, ADDRESS FROM users WHERE Name = 'John'); It will still find all the records you want and only uses Name as the condition. However yes it is possible to use wildcards...MOST databases support it but you'll need to check with your db distributor to know for sure. Typically the wildcard is % (an equivalent to * as a wild card)...some DBs also support ? as a one character wild card...however to use them you have to use the LIKE function. So say if you wanted to find queries WHERE the name started with an A $qid = db_query(SELECT ID, NAME, ADDRESS FROM users WHERE Name LIKE 'A%'); Sincerely, Craig Vincent -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: Wildcards
Morten Nielsen wrote: It is because it is a search function where a user can enter an ID, NAME and ADDRESS to search after. If one of the fields are empty it should use the wildcard. Then while you're constructing the search string, evaluate whether that field is empty or not (isset() should work fine for this). If it's empty, stick '%' in the string, otherwise use the variable contents. Actually if it's empty it would be better just to omit the field from being part of the WHERE condition at all =) But excellent advice nonetheless...much better than what I was going to suggest =) Sincerely, Craig Vincent -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Exclude indentical values
Is it possible to exclude identical value's using a mysql query statment? E.g. I've got 2 colums named BlaID and BlaInfo. BlaID may contain 20 times the value 75 and 10 times the value 54. What I want to do is being able to retrieve the value 75 and 54 only once (with the vlue of BlaInfo). Is this possible to do with one statement? I'm not sure what you're asking for. Are you saying if you had a table like BlaID BlaInfo 75 100 54 125 75 90 54 110 You'd want a result like | BlaInfo | BlaID | - | | 75 | | | 54 | | 100 | | | 125 | | | 90 | | | 110 | | - ? Perhaps an example would clear things up of what you would like =) Sincerely, Craig Vincent -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] IP Address?
How can I find out the IP address of the client requesting a given php file? I know that you can use $HTTP_SERVER_VARS[REMOTE_ADDR] in more recent versions of PHP. Unfortunately, we only have PHP3.0.14 and I don't think that this option is available in our ancient version. I also can't use server side includes. An upgrade to PHP4 is in the works, but I can't wait that long. How can I get a client's IP address with PHP3.014 and/or JavaScript? Thanks in advance. I believe $ip = getenv('REMOTE_ADDR'); will do what you want. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Resource ID
Scott, The resource IDs are integer identifiers PHP uses to identify the different queries being done on the system. However if you want to actually extract the information from those queries you need to use either the mysql_fetch_row() or mysql_fetch_array queries. Oh and on another note a separate function/class isn't really all that necessary to query a table in another database...based on the code you provided. $q = mysql_query(SELECT id FROM $db.words WHERE word = '$word'); would work just as easily if not faster and using less resources =) Sincerely, Craig Vincent -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] 'replace' with 'where'
snip $result_insert = mysql_query(replace into wantlist where id = '$id' values ('', '$artist', '$title', '$tracks', '', '', '')); the $id is already defined in the url, by the way (ex. snip The way replace works is it looks for a unique index key in your update list, if it finds one it uses that key to determine where the REPLACE is done. The update command would probably work better for you if all you're wanting to do is change column values of a record already stored in the table. It's also much easier and versatile Sincerely, Craig Vincent -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] INSERT Won't Insert
If you simplify the query you'll see your error...all those escaped were giving me a headache hehe snip *modified* $add_co_sql = INSERT INTO $table_name (CompanyID, CompanyName, Address, City, StateorProvince, PostalCode,Region,Country,WebSite)VALUES ('','$CompanyName','$Address','$City','$StateorProvince','$PostalCode','$Reg ion','$Country','$WebSite'; /snip If you're still missing it, you're missing a ) after '$WebSite' Sincerely, Craig Vincent -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Problem importing large db to mysql in windows
I'm running a local web server for development on my Win ME machine using apache, mysql 3.23.38, and php4. I've been copying my mysql database that is online to my local one every once in a while. When the Since you're using relatively recent version of MySQL might I suggest you setting up the MySQL replication system (chap 11 in the manual if I remember correctly). You don't have to be constantly receiving updates however if setup correctly you can use the LOAD table FROM master command to grab the most recent copy of the table you want in a single command. Sincerely, Craig Vincent -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Problem with my first script
snip $myrow=mysql_fetch_array ($result); /snip Remove the space in the function call and it should work fine for you ie. $myrow=mysql_fetch_array($result); Sincerely, Craig Vincent -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] mssql_connect() function not found when I load the page...
snip mssql_connect( ) function not found. Could someone tell me how to solve this problem? /snip You need to recompile PHP to include MSSQL support Sincerely, Craig Vincent -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] mssql_fetch_array problem
Not being able to see your code and not knowing exactly what problem you are having I can only throw a few guesses here. If you could elaborate more on what you are expecting and what you are getting that would be a big help. snip $country_sql = select countryname, countryid from TBL_COUNTRY; /snip You don't use the value of countryname anywhere in your statement...is it necessary? snip if ($country_query = mssql_query($country_sql)) { /snip What is this statement intended to do? Typical when a query is formed PHP gives the query an integer id. But that ID is allocated by PHP and if you add a new query earlier in the code later on the ID for this query will most likely change...which then will make it not equal what you're expecting it to equal...in this case $country_query. Also on a further note you need to use == instead of = otherwise PHP will assume the statement is always true. snip while ($myrow = mssql_fetch_array($country_query)) if ($country == $myrow[countryid]) { print option value= . $myrow[countryid] . selected . $countryid . /option; } else { print option value= . $myrow[countryid] . . $countryid . /option; } } } /snip Your while statement is missing a { was this code working when you used it? Also unless you need PHP returning the success of printing the text you're better off using echo instead of print. Based on what I see this code may be what you're looking for (untested) $country_sql = 'SELECT countryid FROM TBL_COUNTRY'; while ($myrow = mssql_fetch_row($country_query)) { echo option value=$myrow[0]; if ($country == $myrow[0]) { echo selected$myrow[0]/option; } else { echo $myrow[0]/option; } } Sincerely, Craig Vincent -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Deleting specific records from MySQL tables
Try putting the variable into single quotes mysql_db_query(phpads, DELETE FROM adviews WHERE bannerID='$banresult[bannerID]'); That should resolve the problem. Sincerely, Craig Vincent -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]