[PHP-DB] Help needed in searching a sentence in the code
Hi All, I have this code where user can search a song or the entire song title. It looks like when a user search a single word its searching and giving the proper results. However if the user wants to search the entire sentence its not giving the proper results. For example let say I have searched for the MJ's song Earth Song, its giving me the proper results. However if I am searching for the MJ's Why You Wanna Trip On Me, its not giving me the proper results. Below is the code: ?php //get data $button = $_GET['submit']; $search = $_GET['search']; $s = 0; $s = $_GET['s']; if (!$s) $s = 0; $i = 0; $e = 30; // Just change to how many results you want per page $next = $s + $e; $prev = $s - $e; if (strlen($search)=2) echo brtable align='center'trtdsupdagger;/supfont face='sana-serif' size='6'font color='blue'bsupa href=' http://localhost/searchengine/' style='text-decoration: none'MP3dom/a/sup/b/b/fontfont face='sana-serif' size='3'suptrade;/sup/tdtdsupform action='search.php' method='GET'input type='text' onclick=value='' size='50' name='search' value='$search' input type='submit' name='submit' value='Search'/form/td/tr/table table bgcolor='#FF' width='100%' height='1px'br //tabletable bgcolor='#f0f7f9' width='100%' height='10px'trtddiv align='right'bMust be greater then 3 chars/b/div/td/tr/tablep/sup; else { echo brtable align='center'trtddagger;font face='sana-serif' size='6'font color='blue'ba href='http://localhost/searchengine/' style='text-decoration: none'MP3dom/a/b/b/fontfont face='sana-serif' size='3'suptrade;/sup/tdtdsubform action='search.php' method='GET'input type='text' onclick=value='' size='50' name='search' value='$search'input type='submit' name='submit' value='Search'/form/td/tr/table/sub; //connect to database mysql_connect(localhost,root,); mysql_select_db(mp3); //explode out search term $search_exploded = explode( ,$search); foreach($search_exploded as $search_each) { //construct query $x++; if ($x==1) $construct .= name LIKE '%$search_each%'; else $construct .= OR name LIKE '%$search_each%'; } //echo outconstruct $constructx = SELECT * FROM data WHERE $construct; $construct = SELECT * FROM data WHERE $construct LIMIT $s,$e ; $run = mysql_query($constructx); $foundnum = mysql_num_rows($run); $run_two = mysql_query($construct); if ($foundnum==0) echo table bgcolor='#F1EDC2' width='100%' height='1px'br //tabletable bgcolor='#f0f7f9' width='100%' height='10px'trtddiv align='right'No results found for b$search/b/div/td/tr/tablep; else { echo table bgcolor='#F1EDC2' width='100%' height='1px'br //tabletable bgcolor='#f0f7f9' width='100%' height='10px'trtddiv align='right'Showing 1-30 of b$foundnum/b results found for b$search./b/div/td/tr/tablep; print 'table bgcolor=#F1EDC2 width=700 height=30 border=0 align=center '; print 'tr'; print 'td width=100 nowrap=nowrapstrongArtist/strong/td'; print 'td width=250 nowrap=nowrapstrongSong Name/strong/td'; print 'td width=50 nowrap=nowrapstrongMovie Date/strong/td'; print 'td width=50 nowrap=nowrapstrongSize/strong/td'; print '/tr'; while ($runrows = mysql_fetch_assoc($run_two)) { //get data $type = $runrows['artist']; $date = $runrows['date']; $name = $runrows['name']; $size = $runrows['size']; foreach ($runrows as $row) { if ($i % 2 != 0) # An odd row $rowColor = #EBECE4; else # An even row $rowColor = #FEF1E9; print 'table width=700 height=30 border=0 align=center'; } print '?php do { ?'; print 'tr bgcolor=' . $rowColor . ''; print 'td nowrap=nowrap width=100'.'font color=:blue size=2'.$type.'/td'; //print 'td nowrap=nowrap width=250'.'font size=2'.a herf='$url'$name.'/td'; print 'td nowrap=nowrap width=250'.'font color=blue size=2'.a href='download.php?url=$url'$name.'/font/td'; print 'td nowrap=nowrap width=100 align=center'.'font size=2'.$date .'/td'; print 'td nowrap=nowrap width=50'.'font size=2'.$size .'/td'; print 'td nowrap=nowrap width=25'.'font size=2'.$se .'/td'; print 'td nowrap=nowrap width=25'.'font size=2'.$le .'/td'; print '/tr'; print '/table'; print '/body'; print '/html'; } ? table width='100%' tr td div align=center brbr ?php if (!$s=0) echo a href='search.php?search=$searchs=$prev'Prev/a; $i =1; for ($x=0;$x$foundnum;$x=$x+$e) { echo a href='search.php?search=$searchs=$x'$i/a ; $i++; } if ($s$foundnum-$e) echo a href='search.php?search=$searchs=$next'Next/a; } } ? /div /td /tr /table *** Also, the above code is giving me the below errors: *Notice*: Undefined index: s in *C:\wamp\www\searchengine\search.php* on line *11 **Notice*: Undefined variable: x in *C:\wamp\www\searchengine\search.php* on line *46* *Notice*: Undefined variable:
[PHP-DB] help needed.
Hello Guys, I am developing an application, which would have a front end in Flash, and the backend would be MySQL, now what I am thinking is to package this as an exe file, similar to WAMP, which installs everything, So my exe should have all my files, the MySQL data dump and should auto install PHP, APACHE, MySQL, can something like this be done, i am sure it can be done, but how do I do it, any guidelines please? Thanks, Vinay Kannan.
[PHP-DB] Help needed - SELECT query optimization
Hi, I have a mysql database with one table in it, currently it contains 36,807 records and it costs 6.8MB of space, every night another thousand~ of rows are being added to the table. The scheme (as taken from phpmyadmin) is like follows: CREATE TABLE IF NOT EXISTS `search` ( `id` int(11) NOT NULL auto_increment, `time` int(10) default NULL, `unique` varchar(255) collate utf8_unicode_ci default NULL, `site` varchar(50) collate utf8_unicode_ci default NULL, `url` varchar(255) collate utf8_unicode_ci default NULL, `filename` varchar(255) collate utf8_unicode_ci default NULL, `snippet` varchar(255) collate utf8_unicode_ci default NULL, `tags` varchar(255) collate utf8_unicode_ci default NULL, `password` varchar(255) collate utf8_unicode_ci default NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=44306 ; insert example: INSERT INTO `search` VALUES (null, 1225041602, '110755357', 'rapidshare', ' http://rapidshare.com/files/110755357/Taxi4.By.HuNTeR.part1.rar', 'Taxi4.By.HuNTeR.part1.rar', 'Taxi 4 (2007) DVDRip XviD - KL', '', '--'),(null, 1225041602, '110756297', 'rapidshare', ' http://rapidshare.com/files/110756297/Taxi4.By.HuNTeR.part2.rar', 'Taxi4.By.HuNTeR.part2.rar', 'Taxi 4 (2007) DVDRip XviD - KL', '', '--'),(null, 1225041602, '110767009', 'rapidshare', ' http://rapidshare.com/files/110767009/Taxi4.By.HuNTeR.part3.rar', 'Taxi4.By.HuNTeR.part3.rar', 'Taxi 4 (2007) DVDRip XviD - KL', '', '--'),(null, 1225041602, '110768015', 'rapidshare', ' http://rapidshare.com/files/110768015/Taxi4.By.HuNTeR.part4.rar', 'Taxi4.By.HuNTeR.part4.rar', 'Taxi 4 (2007) DVDRip XviD - KL', '', '--'),(null, 1225041602, '110779013', 'rapidshare', ' http://rapidshare.com/files/110779013/Taxi4.By.HuNTeR.part5.rar', 'Taxi4.By.HuNTeR.part5.rar', 'Taxi 4 (2007) DVDRip XviD - KL', '', '--'),(null, 1225041602, '110792243', 'rapidshare', ' http://rapidshare.com/files/110792243/Taxi4.By.HuNTeR.part6.rar', 'Taxi4.By.HuNTeR.part6.rar', 'Taxi 4 (2007) DVDRip XviD - KL', '', '--'),(null, 1225041602, '110793721', 'rapidshare', ' http://rapidshare.com/files/110793721/Taxi4.By.HuNTeR.part7.rar', 'Taxi4.By.HuNTeR.part7.rar', 'Taxi 4 (2007) DVDRip XviD - KL', '', '--'); It should be a rapidshare links database (which updates with a PHP crawler I wroted last Saturday). I would like to change the snippet to title and add another column for the snippet, My main queries are INSERT's - a big insert (usually 10-100 links per insert) in each hour. My crawler is checking if the link it is about to add is already in the database with a select query like this: SELECT `id` FROM `tbl_name` WHERE `unique` = '%_UNIQUE_VARIABLE_%' I'm definiatly not an database scheme expert, I'm looking to optimaize the table for fast select queries (to check if file is already exists) And for fast filename-based search (select * from `tbl_name` where `filename` like '%_WHATEVER_%') The unique colmn is used for other websites unique ID's as well so I don't think I have any chance to crop it's length. I probably can change the site colmn to numeric id or something (I'm just about doing that) - but this is not the real problems, I have heard about something called Indexes but I have no idea what this is about. I hope I will find an answer, or a path where to look for in order to get this table optimaized, Thanks in Advance, Nitsan
Re: [PHP-DB] Help needed - SELECT query optimization
It should be a rapidshare links database (which updates with a PHP crawler I wroted last Saturday). I would like to change the snippet to title and add another column for the snippet, My main queries are INSERT's - a big insert (usually 10-100 links per insert) in each hour. My crawler is checking if the link it is about to add is already in the database with a select query like this: SELECT `id` FROM `tbl_name` WHERE `unique` = '%_UNIQUE_VARIABLE_%' create index unique_idx on tbl_name(unique); mysql might work better with this index: create index unique_idx on tbl_name(unique, id); because in some cases it doesn't have to go back to the data file to get the actual data, it can just read everything from the index. I'm definiatly not an database scheme expert, I'm looking to optimaize the table for fast select queries (to check if file is already exists) And for fast filename-based search (select * from `tbl_name` where `filename` like '%_WHATEVER_%') like queries are harder to optimize. If you put a wildcard at the front: like '%...%'; the db can't use an index to find it, because you're saying the text can be anywhere and for that type of search you're best off setting up fulltext (http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html). If you don't put a % at the front: like '...%'; the db use an index to find it (up until the wildcard).. create index filename_idx on tbl_name(filename); To understand indexing, check out my article: http://www.designmagick.com/article/16/PostgreSQL/How-to-index-a-database (Yes it's on a postgres site but the ideas/understanding work for all db's - and the commands should even work for mysql). -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Help needed PHP with Excel database
Hi I am a PHP beginner and using Namo Webeditor trial version in order to access an Excel file via ODBC...and I get no result Namo generates the following code: = ? $a_startrow = $startrow; $a_maxrows = $maxrows; require('wed_php_odbc.inc'); ?html head titleSans titre/title meta name=generator content=Namo WebEditor v6.0 /head body bgcolor=white text=black link=blue vlink=purple alink=red ? $w_disprows = 10; $w_sqlstr = SELECT Feuli1$_FilterDatabase.Country, Feuli1$_FilterDatabase.Customer Name, Feuli1$_FilterDatabase.Model, Feuli1$_FilterDatabase.Description, Feuli1$_FilterDatabase.Order Number, Feuli1$_FilterDatabase.Quantity FROM Feuli1$_FilterDatabase; wed_read_list_process (trydb, , , $w_sqlstr, $w_record, $w_disprows, $a_startrow, $a_maxrows, $w_rows); ?table border=1 tr td width=160Feuli1$_FilterDatabase.Country/td td width=160Feuli1$_FilterDatabase.Customer Name/td td width=160Feuli1$_FilterDatabase.Model/td td width=160Feuli1$_FilterDatabase.Description/td td width=160Feuli1$_FilterDatabase.Order Number/td td width=160Feuli1$_FilterDatabase.Quantity/td /tr ? for ($w_i = 0; $w_i $w_rows; $w_i++) { $f_Feuli1__FilterDatabase_Country = $w_record[$w_i][0]; $f_Feuli1__FilterDatabase_Customer_Name = $w_record[$w_i][1]; $f_Feuli1__FilterDatabase_Model = $w_record[$w_i][2]; $f_Feuli1__FilterDatabase_Description = $w_record[$w_i][3]; $f_Feuli1__FilterDatabase_Order_Number = $w_record[$w_i][4]; $f_Feuli1__FilterDatabase_Quantity = $w_record[$w_i][5]; ?tr td width=162? wed_write($f_Feuli1__FilterDatabase_Country); ?/td td width=162? wed_write($f_Feuli1__FilterDatabase_Customer_Name); ?/td td width=162? wed_write($f_Feuli1__FilterDatabase_Model); ?/td td width=162? wed_write($f_Feuli1__FilterDatabase_Description); ?/td td width=162? / wed_write($f_Feuli1__FilterDatabase_Order_Number); ?/td td width=162? wed_write($f_Feuli1__FilterDatabase_Quantity); ?/td /tr ? } ?tr td width=993 colspan=6? wed_list_move_page(10, $w_disprows, $a_startrow, $a_maxrows, ); ?/td /tr /table pnbsp;/p /body /html === where wed_php_odbc.inc contains: === function wed_read_list_process($servername, $userid, $passwd, $sqlstr, $record, $disprows, $startrow, $maxrows, $rows) { $connect = odbc_connect($servername, $userid, $passwd); $cursor = odbc_exec($connect, $sqlstr); // skip pre list for ($i = 0; $i $startrow; $i++) { odbc_fetch_into($cursor, /*$i,*/ $row); } // fetch list (max disprows rows) for ($rows = 0; ($rows $disprows) odbc_fetch_into($cursor, /*$startrow + $rows,*/ $row); $rows++) { $record[$rows] = $row; } // determine maxrows if ($maxrows == 0) { for ($maxrows = $startrow + $rows; odbc_fetch_into($cursor, /*$maxrows,*/ $row); $maxrows++) { ; } } odbc_close($connect); } === and === function wed_write($value) { if ($value != null) { $length = strlen($value); $pos1 = strpos($value, #); if ($pos1 !== FALSE) { $pos2 = strpos($value, #, $pos1+1); if ($length == $pos2 + 1) { $link_str = substr($value, $pos1 + 1, $pos2 - $pos1 - 1); if ($pos1 == 0) $text_str = substr($value, $pos1 + 1, $pos2 - $pos1 - 1); else $text_str = substr($value, 0, $pos1); $value = sprintf(a href=\%s\%s/a, $link_str, $text_str); } } $w_value = str_replace(\n, br, $value); } else { $w_value = nbsp;; } echo($w_value); } === I never get the expected value. My excel file is : === Customer Name Model Description Order NumberQuantity CustUK1Pan1 Pan UK001 2 CustUK2Fork1Fork UK002 5 CustFR knife1 knife FR00115 === and I get: === Feuli1$_FilterDatabase.Country Feuli1$_FilterDatabase.Customer Name Feuli1$_FilterDatabase.ModelFeuli1$_FilterDatabase.Description Feuli1$_FilterDatabase.Order Number Feuli1$_FilterDatabase.Quantity [ ] where Feuli1 is the name of the spreadsheet
[PHP-DB] Help needed
Hi, I'm testing a program and I need you assistance. Please unzip the file at http://www.biz-mu.com/PCID.zip and run the program. It will display an ID, please mail me back the ID. If you can use it on several computers, it will be even better for me, I need to have as much results as possible. The program i'm testing is supposed to create a unique ID for each PC, this is why I need to test if it is really unique. This file is virus free and cannot do any harm to your PC. It is however a voluntary testing. Thanks for your help in advance. Velen
[PHP-DB] Help Needed!!
Hello, I have an input field that inserts data into an oracle table. The users of the system will be composing the data that goes into this input field in Microsoft Word. They will also be using Microsoft Word formatting features. 1. Is it possible for my input box to retain the formatting and if so how? 2. Can the Oracle database store this type of formatting? 3. Can the data and formatting then be extracted in XML Thanks, David David Skyers Support Analyst Management Systems, EISD, UCL Extension: 41849 Tel: 020 7679 1849 Email: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help Needed!!
Forgive me for saying this, but you should be posting this to the Oracle mailing list, not here. David Skyers wrote: Hello, I have an input field that inserts data into an oracle table. The users of the system will be composing the data that goes into this input field in Microsoft Word. They will also be using Microsoft Word formatting features. 1. Is it possible for my input box to retain the formatting and if so how? 2. Can the Oracle database store this type of formatting? 3. Can the data and formatting then be extracted in XML Thanks, David David Skyers Support Analyst Management Systems, EISD, UCL Extension: 41849 Tel: 020 7679 1849 Email: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help Needed!!
1. yes, user a rich text editor plugin in you web page (http://www.kevinroth.com/rte/ is one such beast) 2. sure, in a text / blob field 3. yes, but likely you'll need to do it as CDATA hth Bastien From: David Skyers [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] Help Needed!! Date: Wed, 8 Nov 2006 11:59:28 - Hello, I have an input field that inserts data into an oracle table. The users of the system will be composing the data that goes into this input field in Microsoft Word. They will also be using Microsoft Word formatting features. 1. Is it possible for my input box to retain the formatting and if so how? 2. Can the Oracle database store this type of formatting? 3. Can the data and formatting then be extracted in XML Thanks, David David Skyers Support Analyst Management Systems, EISD, UCL Extension: 41849 Tel: 020 7679 1849 Email: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Say hello to the next generation of Search. Live Search try it now. http://www.live.com/?mkt=en-ca -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help needed creating a social network
Thanks for the reply. However, that only gives me a single degree. I'm looking for the way to traverse a 'tree' to see who is in your extended networks, so I can do things like: You are 4 degrees away from Sam: You know bob who knows john who knows carrol who knows Sam. Sam - carrol - john - bob - you Etc. -Original Message- From: Micah Stevens [mailto:[EMAIL PROTECTED] Sent: Monday, March 06, 2006 10:28 PM To: php-db@lists.php.net Subject: Re: [PHP-DB] Help needed creating a social network CREATE TABLE `users` (userID int(11) not null auto_increment, primary key(userID), name tinytext not null, email tinytext not null); CREATE TABLE `links` (userID int(11), key (userID), friendID int(11), key(friendID)); ?php $friends = mysql_query(select users.name, users.userID from users left join links on links.friendID = users.userID where links.userID = {$_GET['userID']}); echo h1You have friends!!/h1; while ($f = mysql_fetch_assoc($friends)) { echo a href='socialnetwork.php?userID={$f['userID']}'{$f['name']}/a br\n; } publish(); profit($greatly); do (!$use) { coldfusion('Cause it sucks'); } ? (har har) On Monday 06 March 2006 9:47 pm, Daevid Vincent wrote: Anyone have some pointers at a HowTo on creating a social network? Basically I need to show people in your immediate network, and also friends of your friends, etc... Like the whole 'six degrees of separation' thing. Ala: myspace, friendster, etc. ad nauseum. I prefer mySQL and PHP, but I could port from most any code. I guess I'm mostly interested in the theory of this an how do I set up the tables properly and what is the magic incantation (JOIN) to get this chain of people. -- 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
RE: [PHP-DB] Help needed creating a social network
My first thought was recursion - repeat the call for each element of the result set, numbering each so you can find each level, until nothing is returned. That would probably work, but oh, what a mess. That triggered something ... off to consult Joe Celko's SQL for Smarties. He has a whole chapter on Trees, and guess what: they're not easily done in relational databases. To try and condense it here would be, shall we say, impractical. Check with a library, or try googling for trees -- hey, look what turned up: http://www.dbmsmag.com/9603d06.html by JC himself. Have fun - Miles Thompson At 03:19 PM 3/7/2006, Daevid Vincent wrote: Thanks for the reply. However, that only gives me a single degree. I'm looking for the way to traverse a 'tree' to see who is in your extended networks, so I can do things like: You are 4 degrees away from Sam: You know bob who knows john who knows carrol who knows Sam. Sam - carrol - john - bob - you Etc. -Original Message- From: Micah Stevens [mailto:[EMAIL PROTECTED] Sent: Monday, March 06, 2006 10:28 PM To: php-db@lists.php.net Subject: Re: [PHP-DB] Help needed creating a social network CREATE TABLE `users` (userID int(11) not null auto_increment, primary key(userID), name tinytext not null, email tinytext not null); CREATE TABLE `links` (userID int(11), key (userID), friendID int(11), key(friendID)); ?php $friends = mysql_query(select users.name, users.userID from users left join links on links.friendID = users.userID where links.userID = {$_GET['userID']}); echo h1You have friends!!/h1; while ($f = mysql_fetch_assoc($friends)) { echo a href='socialnetwork.php?userID={$f['userID']}'{$f['name']}/a br\n; } publish(); profit($greatly); do (!$use) { coldfusion('Cause it sucks'); } ? (har har) On Monday 06 March 2006 9:47 pm, Daevid Vincent wrote: Anyone have some pointers at a HowTo on creating a social network? Basically I need to show people in your immediate network, and also friends of your friends, etc... Like the whole 'six degrees of separation' thing. Ala: myspace, friendster, etc. ad nauseum. I prefer mySQL and PHP, but I could port from most any code. I guess I'm mostly interested in the theory of this an how do I set up the tables properly and what is the magic incantation (JOIN) to get this chain of people. -- 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 -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.1.375 / Virus Database: 268.2.0/275 - Release Date: 3/6/2006 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Help needed creating a social network
Anyone have some pointers at a HowTo on creating a social network? Basically I need to show people in your immediate network, and also friends of your friends, etc... Like the whole 'six degrees of separation' thing. Ala: myspace, friendster, etc. ad nauseum. I prefer mySQL and PHP, but I could port from most any code. I guess I'm mostly interested in the theory of this an how do I set up the tables properly and what is the magic incantation (JOIN) to get this chain of people. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help needed creating a social network
CREATE TABLE `users` (userID int(11) not null auto_increment, primary key(userID), name tinytext not null, email tinytext not null); CREATE TABLE `links` (userID int(11), key (userID), friendID int(11), key(friendID)); ?php $friends = mysql_query(select users.name, users.userID from users left join links on links.friendID = users.userID where links.userID = {$_GET['userID']}); echo h1You have friends!!/h1; while ($f = mysql_fetch_assoc($friends)) { echo a href='socialnetwork.php?userID={$f['userID']}'{$f['name']}/abr\n; } publish(); profit($greatly); do (!$use) { coldfusion('Cause it sucks'); } ? (har har) On Monday 06 March 2006 9:47 pm, Daevid Vincent wrote: Anyone have some pointers at a HowTo on creating a social network? Basically I need to show people in your immediate network, and also friends of your friends, etc... Like the whole 'six degrees of separation' thing. Ala: myspace, friendster, etc. ad nauseum. I prefer mySQL and PHP, but I could port from most any code. I guess I'm mostly interested in the theory of this an how do I set up the tables properly and what is the magic incantation (JOIN) to get this chain of people. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Help Needed with malfunctioning query
Hi there everyone, This line of code USED TO WORK but now it gives me a Coudln't Execute Query error: $query2 = SELECT word,def,photo MATCH(word,def) AGAINST ('$txtsearchword' IN BOOLEAN MODE) AS m FROM dictionary WHERE MATCH(word,def) AGAINST ('$txtsearchword' IN BOOLEAN MODE) LIMIT $offset, $item_perpage; I tried it with a basic $query2 = SELECT * FROM dictionary; to make sure it wasn't something else that was broke and this is the problem above, it used to work great and now it's on a live site after working great for 6 months and it suddenly doesn't work and I haven't touched anything !!! the server hasn't been updated so it's not that as it also does the same on my local dev machine here, the only thing that happened was my co-worker did a global find and replace with dreamweaver but that's all and I can't personally see anything wrong with the above though I could be looking too hard. Any help would REALLY be appreciated as this is on a very popular website and needs fixing ASAP so I don't lose my head !!! Chris
RE: [PHP-DB] Help Needed with malfunctioning query
Hi there, I'm using asd just to test the search, here's the output from the statement echoed to the screen: SELECT word,def,photo, if(locate('asd',word),1,2) as meFirst ,MATCH(word,def) AGAINST ('asd' IN BOOLEAN MODE) AS m FROM dictionary WHERE MATCH(word,def) AGAINST ('asd' IN BOOLEAN MODE) ORDER BY meFirst, word LIMIT 0, 25 Chris This line of code USED TO WORK but now it gives me a Coudln't Execute Query error: $query2 = SELECT word,def,photo MATCH(word,def) AGAINST ('$txtsearchword' IN BOOLEAN MODE) AS m FROM dictionary WHERE MATCH(word,def) AGAINST ('$txtsearchword' IN BOOLEAN MODE) LIMIT $offset, $item_perpage; What is the exact error phrase? Did you echo the $sql statement so you can see if the variables are correct? -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 268.1.0/269 - Release Date: 2/24/2006 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help Needed with malfunctioning query
On 26/02/2006 3:03 PM, Chris Payne wrote: Hi there everyone, This line of code USED TO WORK but now it gives me a Coudln't Execute Query error: $query2 = SELECT word,def,photo MATCH(word,def) AGAINST ('$txtsearchword' IN BOOLEAN MODE) AS m FROM dictionary WHERE MATCH(word,def) AGAINST ('$txtsearchword' IN BOOLEAN MODE) LIMIT $offset, $item_perpage; I tried it with a basic $query2 = SELECT * FROM dictionary; to make sure it wasn't something else that was broke and this is the problem above, it used to work great and now it's on a live site after working great for 6 months and it suddenly doesn't work and I haven't touched anything !!! the server hasn't been updated so it's not that as it also does the same on my local dev machine here, the only thing that happened was my co-worker did a global find and replace with dreamweaver but that's all and I can't personally see anything wrong with the above though I could be looking too hard. Should there be a comma between 'photo' and 'MATCH(word, def) etc'? As in: $query2 = SELECT word,def,photo, MATCH(word,def) AGAINST ('$txtsearchword' IN BOOLEAN MODE) AS m FROM dictionary WHERE MATCH(word,def) AGAINST ('$txtsearchword' IN BOOLEAN MODE) LIMIT $offset, $item_perpage; Much warmth, planetthoughtful --- Lost in thought http://www.planetthoughtful.org Urban legends, superstitions, ghost stories and folklore http://www.ulblog.org -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Help Needed
All, I know this is the wrong distro to be sending this request for help to but I dont know which one to send this to. If you could either point me in the direction that I should go or help me, I would greatly appreciate it. Here is my issue. I have a set of date that I want returned in 3 columns and an unspecified number of rows (dependent on the number of records returned). I cannot for the life of me figure out how to do this. Looking something like this 1st record 2Nd record 3trd record 4th record 5th record 6th record 7th record 8th record 9th record And so on And so fourth Can any one help me out with this, or point me to the distro that can help me? Thanks -Rich
RE: [PHP-DB] Help Needed
Sorry, the data under 'Looking something like this' should be in a table format with 3 columns and 4 rows. -Original Message- From: ReClMaples [mailto:[EMAIL PROTECTED] Sent: Friday, July 29, 2005 8:46 PM To: PHP Subject: [PHP-DB] Help Needed All, I know this is the wrong distro to be sending this request for help to but I don't know which one to send this to. If you could either point me in the direction that I should go or help me, I would greatly appreciate it. Here is my issue. I have a set of date that I want returned in 3 columns and an unspecified number of rows (dependent on the number of records returned). I cannot for the life of me figure out how to do this. Looking something like this 1st record 2Nd record 3trd record 4th record 5th record 6th record 7th record 8th record 9th record And so on And so fourth ... Can any one help me out with this, or point me to the distro that can help me? Thanks -Rich -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help Needed
ReClMaples a écrit : Sorry, the data under 'Looking something like this' should be in a table format with 3 columns and 4 rows. -Original Message- From: ReClMaples [mailto:[EMAIL PROTECTED] Sent: Friday, July 29, 2005 8:46 PM To: PHP Subject: [PHP-DB] Help Needed All, I know this is the wrong distro to be sending this request for help to but I don't know which one to send this to. If you could either point me in the direction that I should go or help me, I would greatly appreciate it. Here is my issue. I have a set of date that I want returned in 3 columns and an unspecified number of rows (dependent on the number of records returned). I cannot for the life of me figure out how to do this. You can do something like this : $i = 0 ; echo tabletr; while (fetch...) { echo td$your_data/td ; // every 3 row if ($i % 3 == 0) echo /trtr ; $i ++ ; } echo /tr/table ; I know it's not perfect, I'll let you rewrite it more elegantly... -- Alain -- http://www.vivahate.org -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help Needed
You ROCK!!! Thanks so much, this worked perfectly!!! Thanks -Rich -Original Message- From: Alain Rivest [mailto:[EMAIL PROTECTED] Sent: Friday, July 29, 2005 10:10 PM To: php-db@lists.php.net Subject: Re: [PHP-DB] Help Needed ReClMaples a écrit : Sorry, the data under 'Looking something like this' should be in a table format with 3 columns and 4 rows. -Original Message- From: ReClMaples [mailto:[EMAIL PROTECTED] Sent: Friday, July 29, 2005 8:46 PM To: PHP Subject: [PHP-DB] Help Needed All, I know this is the wrong distro to be sending this request for help to but I don't know which one to send this to. If you could either point me in the direction that I should go or help me, I would greatly appreciate it. Here is my issue. I have a set of date that I want returned in 3 columns and an unspecified number of rows (dependent on the number of records returned). I cannot for the life of me figure out how to do this. You can do something like this : $i = 0 ; echo tabletr; while (fetch...) { echo td$your_data/td ; // every 3 row if ($i % 3 == 0) echo /trtr ; $i ++ ; } echo /tr/table ; I know it's not perfect, I'll let you rewrite it more elegantly... -- Alain -- http://www.vivahate.org -- 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] Help needed
hi, I am new to PHP and I am not sure if this is the right forum. I am trying to run PHP thro webmin using CGI scripts. PHP runs fine except that when I am trying to read variables coming thro' a form after hitting the submit button, I get NULL values. I can read and write to the database without any trouble. The problem is reading the form values. Any help would be greatly appreciated. Many Thanks, Manoj Life,it is not a problem to be solved, but a process to be managed.
RE: [PHP-DB] Help needed
Check to see if your register_globals is set to off in php.ini. If so (likely, since it defaults to that value) you'll need to access your POST and GET variables like this: GET vars: $var = $_GET['var']; POST vars: $var = $_POST['var']; Gary Every Sr. UNIX Administrator Ingram Entertainment Inc. 2 Ingram Blvd, La Vergne, TN 37089 Pay It Forward! -Original Message- From: Manoj Japher [mailto:[EMAIL PROTECTED] Sent: Monday, October 04, 2004 9:29 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Help needed hi, I am new to PHP and I am not sure if this is the right forum. I am trying to run PHP thro webmin using CGI scripts. PHP runs fine except that when I am trying to read variables coming thro' a form after hitting the submit button, I get NULL values. I can read and write to the database without any trouble. The problem is reading the form values. Any help would be greatly appreciated. Many Thanks, Manoj Life,it is not a problem to be solved, but a process to be managed. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help needed with variable scoping? or mysql problem
Oh yeah that's the ticket! I'd forgotten that I'd removed the mysql_select_db statement when doing some earlier 'cleanup'. It just so happens that a few of the mysql metadata calls (like listing fields/etc.) were inadvertently setting the db...but only for a brief period of time...wierd. As I mentioned, I just started using php yesterday, so I'm still learning some tips/tricks. But...to php's credit, I gotten a fairly functional rdbms explorer/browser/editor going in under a day. I had initially planned on 'hardcoding' some rdbms master/detail forms, but after doing just one of them, and seeing the plethora of mysql calls available, I decided to genericize the code, and now it's a general explorer/etc. for all of my databases. Seems pretty speedy too. Now I just need to add result set 'scrolling'. Returning 2000 records is not nice... thanks buddy... -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2003 8:10 AM To: Mike Klein Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Help needed with variable scoping? or mysql problem best way to tell is to place .'or die(mysql_error())' after any call to mysql_query() to see what mysql is complaining about. personally I sometimes declare the query first so i can echo that as well after the msyql_error() function, so i can see the query that has just been excecuted. helpful with dynamic queries. $qry = SELECT * FROM $tableName where $fieldName='$fieldValue'; $result = mysql_query($qry, $conn) or die(mysql_error() . $qry); hth jeff Mike Klein [EMAIL PROTECTED]To: [EMAIL PROTECTED] rg cc: Subject: [PHP-DB] Help needed with variable scoping? or mysql problem 08/14/2003 08:58 AM I've been using JSP for some time now, and thought I'd write a couple of rdbms explorers (flat tables, simple master/detail paradigm) using other technologies, like PHP, Cocoon, etc. Well...it's been fun. I have more working than not. But now I am hung up. I am getting wierd results in a php script when I simply change the order of some mysql calls. I'm using php-4.3.2, rh9, and mysql 3.23. My error is the following (the first line above the Warning below is a dump of parameters to the showMaster function which is what's bombing): conn=Resource id #3 databaseName=info tableName=movies fieldName=title fieldValue=36th Chamber Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /foo/bar/mywebsite/private/database.php on line 107 Line 107 is the first mysql_num_rows call below. function showMaster($conn, $databaseName, $tableName, $fieldName, $fieldValue) { echo conn=$conn\n; echo databaseName=$databaseName\n; echo tableName=$tableName\n; echo fieldName=$fieldName\n; echo fieldValue=$fieldValue\n; This code fails when placed here== $result = mysql_query(SELECT * FROM $tableName where $fieldName='$fieldValue', $conn); $numRows = mysql_num_rows($result); if(mysql_num_rows($result) == 1) { showDetail($conn, $databaseName, $tableName, $fieldName, $fieldValue, $result); exit; } echo numRows=$numRows\n; $fields = mysql_list_fields($databaseName, $tableName, $conn); $numFields = mysql_num_fields($fields); echo TABLE border=1 width=100%\n; echo tr; for($i = 0; $i $numFields; $i++) { printf(td%s/td, mysql_field_name($fields, $i)); } echo /tr; The SAME code succeeds when placed here!== $result = mysql_query(SELECT * FROM $tableName where $fieldName='$fieldValue', $conn); $numRows = mysql_num_rows($result); if(mysql_num_rows($result) == 1) { showDetail($conn, $databaseName, $tableName, $fieldName, $fieldValue, $result); exit; } echo numRows=$numRows\n; while($myrow = mysql_fetch_array($result)) ...rest of method... } Any ideas on why this is? When I move the lines above (from $result=...to...echo 'numRows') down a few lines to just before the mysql_fetch_array, then everything works. Whazzup?!? mike klein -- 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] Help needed with variable scoping? or mysql problem
I've been using JSP for some time now, and thought I'd write a couple of rdbms explorers (flat tables, simple master/detail paradigm) using other technologies, like PHP, Cocoon, etc. Well...it's been fun. I have more working than not. But now I am hung up. I am getting wierd results in a php script when I simply change the order of some mysql calls. I'm using php-4.3.2, rh9, and mysql 3.23. My error is the following (the first line above the Warning below is a dump of parameters to the showMaster function which is what's bombing): conn=Resource id #3 databaseName=info tableName=movies fieldName=title fieldValue=36th Chamber Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /foo/bar/mywebsite/private/database.php on line 107 Line 107 is the first mysql_num_rows call below. function showMaster($conn, $databaseName, $tableName, $fieldName, $fieldValue) { echo conn=$conn\n; echo databaseName=$databaseName\n; echo tableName=$tableName\n; echo fieldName=$fieldName\n; echo fieldValue=$fieldValue\n; This code fails when placed here== $result = mysql_query(SELECT * FROM $tableName where $fieldName='$fieldValue', $conn); $numRows = mysql_num_rows($result); if(mysql_num_rows($result) == 1) { showDetail($conn, $databaseName, $tableName, $fieldName, $fieldValue, $result); exit; } echo numRows=$numRows\n; $fields = mysql_list_fields($databaseName, $tableName, $conn); $numFields = mysql_num_fields($fields); echo TABLE border=1 width=100%\n; echo tr; for($i = 0; $i $numFields; $i++) { printf(td%s/td, mysql_field_name($fields, $i)); } echo /tr; The SAME code succeeds when placed here!== $result = mysql_query(SELECT * FROM $tableName where $fieldName='$fieldValue', $conn); $numRows = mysql_num_rows($result); if(mysql_num_rows($result) == 1) { showDetail($conn, $databaseName, $tableName, $fieldName, $fieldValue, $result); exit; } echo numRows=$numRows\n; while($myrow = mysql_fetch_array($result)) ...rest of method... } Any ideas on why this is? When I move the lines above (from $result=...to...echo 'numRows') down a few lines to just before the mysql_fetch_array, then everything works. Whazzup?!? mike klein -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help needed with variable scoping? or mysql problem
best way to tell is to place .'or die(mysql_error())' after any call to mysql_query() to see what mysql is complaining about. personally I sometimes declare the query first so i can echo that as well after the msyql_error() function, so i can see the query that has just been excecuted. helpful with dynamic queries. $qry = SELECT * FROM $tableName where $fieldName='$fieldValue'; $result = mysql_query($qry, $conn) or die(mysql_error() . $qry); hth jeff Mike Klein [EMAIL PROTECTED]To: [EMAIL PROTECTED] rg cc: Subject: [PHP-DB] Help needed with variable scoping? or mysql problem 08/14/2003 08:58 AM I've been using JSP for some time now, and thought I'd write a couple of rdbms explorers (flat tables, simple master/detail paradigm) using other technologies, like PHP, Cocoon, etc. Well...it's been fun. I have more working than not. But now I am hung up. I am getting wierd results in a php script when I simply change the order of some mysql calls. I'm using php-4.3.2, rh9, and mysql 3.23. My error is the following (the first line above the Warning below is a dump of parameters to the showMaster function which is what's bombing): conn=Resource id #3 databaseName=info tableName=movies fieldName=title fieldValue=36th Chamber Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /foo/bar/mywebsite/private/database.php on line 107 Line 107 is the first mysql_num_rows call below. function showMaster($conn, $databaseName, $tableName, $fieldName, $fieldValue) { echo conn=$conn\n; echo databaseName=$databaseName\n; echo tableName=$tableName\n; echo fieldName=$fieldName\n; echo fieldValue=$fieldValue\n; This code fails when placed here== $result = mysql_query(SELECT * FROM $tableName where $fieldName='$fieldValue', $conn); $numRows = mysql_num_rows($result); if(mysql_num_rows($result) == 1) { showDetail($conn, $databaseName, $tableName, $fieldName, $fieldValue, $result); exit; } echo numRows=$numRows\n; $fields = mysql_list_fields($databaseName, $tableName, $conn); $numFields = mysql_num_fields($fields); echo TABLE border=1 width=100%\n; echo tr; for($i = 0; $i $numFields; $i++) { printf(td%s/td, mysql_field_name($fields, $i)); } echo /tr; The SAME code succeeds when placed here!== $result = mysql_query(SELECT * FROM $tableName where $fieldName='$fieldValue', $conn); $numRows = mysql_num_rows($result); if(mysql_num_rows($result) == 1) { showDetail($conn, $databaseName, $tableName, $fieldName, $fieldValue, $result); exit; } echo numRows=$numRows\n; while($myrow = mysql_fetch_array($result)) ...rest of method... } Any ideas on why this is? When I move the lines above (from $result=...to...echo 'numRows') down a few lines to just before the mysql_fetch_array, then everything works. Whazzup?!? mike klein -- 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
Re: [PHP-DB] Help Needed
-- pada 2002-12-26, 14:36:00 [EMAIL PROTECTED] menulis: -- Hi. I juz installed a RedHat 8.0 on my machine. But then I have a problem in configuring Apache 2.0.4 to use PHP 4.20.. It's preety weird.. coz there's nothing shown up in the browser when I run phpinfo(); or even a simple 'helloworld' code. When I view the source by right-clicking.. it shows the php code.. but why it didn't show anything in the browser ??? I've done all the procedures according to manual. but not working at all. check httpd.conf or something similar make sure correct .php parsing salam, adi s. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help Needed
Everything's perfect.. except my browser keep blank when I run my php files... --www.kapsul.org-- DuFronte -Original Message- From: adi setiawan [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 26, 2002 5:00 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Help Needed -- pada 2002-12-26, 14:36:00 [EMAIL PROTECTED] menulis: -- Hi. I juz installed a RedHat 8.0 on my machine. But then I have a problem in configuring Apache 2.0.4 to use PHP 4.20.. It's preety weird.. coz there's nothing shown up in the browser when I run phpinfo(); or even a simple 'helloworld' code. When I view the source by right-clicking.. it shows the php code.. but why it didn't show anything in the browser ??? I've done all the procedures according to manual. but not working at all. check httpd.conf or something similar make sure correct .php parsing salam, adi s. -- 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
Re: [PHP-DB] Help Needed
Everything's perfect.. except my browser keep blank when I run my php files... No, obviously it's not perfect because it's not working at all. Your page is blank because ? phpinfo() ? will be evaluated as an unknown HTML tag and come out blank. Find another tutorial that discusses how to set up what you want and follow it step by step. ---John Holmes... I juz installed a RedHat 8.0 on my machine. But then I have a problem in configuring Apache 2.0.4 to use PHP 4.20.. It's preety weird.. coz there's nothing shown up in the browser when I run phpinfo(); or even a simple 'helloworld' code. When I view the source by right-clicking.. it shows the php code.. but why it didn't show anything in the browser ??? I've done all the procedures according to manual. but not working at all. check httpd.conf or something similar make sure correct .php parsing -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help Needed
At 02:36 PM 12/26/02 +0700, dufronte wrote: Hi. I juz installed a RedHat 8.0 on my machine. But then I have a problem in configuring Apache 2.0.4 to use PHP 4.20.. Apache 2 and PHP are not ready for prime time. If you must use Apache 2 with PHP, you are on the bleeding edge, and should plan on helping debug the combination. Certainly there are some combinations of versions and configurations that do work, but there are many, many more that do not. If you have time to study and test Apache 2 + PHP, I'm sure your help would be welcome. If you want it to just work, you should be using Apache 1.3. Rick -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help Needed
I juz solved my problems last night... When I searched PHP.net.. I found out that PHP.4.3.ORC4 is compatible for APACHE2 but it isn't released yet... When I installed it.. it works... now I can use PHP in my APACHE2... Juz for information for somebody who have the same problem like me, you can use the PHP.4.3.ORC4 for APACHE2.. it's more stable.. I guarantee... Download : http://qa.php.net --www.kapsul.org-- DuFronte -Original Message- From: Rick Widmer [mailto:[EMAIL PROTECTED]] Sent: Friday, December 27, 2002 8:18 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Help Needed At 02:36 PM 12/26/02 +0700, dufronte wrote: Hi. I juz installed a RedHat 8.0 on my machine. But then I have a problem in configuring Apache 2.0.4 to use PHP 4.20.. Apache 2 and PHP are not ready for prime time. If you must use Apache 2 with PHP, you are on the bleeding edge, and should plan on helping debug the combination. Certainly there are some combinations of versions and configurations that do work, but there are many, many more that do not. If you have time to study and test Apache 2 + PHP, I'm sure your help would be welcome. If you want it to just work, you should be using Apache 1.3. Rick -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Help Needed
Hi. I juz installed a RedHat 8.0 on my machine. But then I have a problem in configuring Apache 2.0.4 to use PHP 4.20.. It's preety weird.. coz there's nothing shown up in the browser when I run phpinfo(); or even a simple 'helloworld' code. When I view the source by right-clicking.. it shows the php code.. but why it didn't show anything in the browser ??? I've done all the procedures according to manual. but not working at all. Please help. ---DuFronte--- http://binusti2002.net.tc http://binusti2002.net.tc/
[PHP-DB] Help Needed
hi, I have started working with PHP-MySQL recently. I have been getting a warning message which i am not able to debug. Could some one pls help me out? The message is Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /usr/local/apache2/htdocs/verify.php on line 37 The code is $db=mysql_pconnect(localhost:/var/lib/mysql/mysql.sock,,); if(!$db) { echo The Server is Busy. Please Try Later ; exit; } mysql_select_db(userinfo); $query = select * from userinfo; $mysql_results = mysql_query($query,$db); line 37:$num_result = mysql_num_rows($mysql_results); if($num_result == 0) { echo PInvalid Username or Password entered/P; exit; } Regards, Manoj 'I have miles to go before I sleep, and promises to keep' -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help Needed
you need a second REQUIRED parameter: mysql_result (PHP 3, PHP 4 ) mysql_result -- Get result data Description mixed mysql_result ( resource result, int row [, mixed field]) as copied from php's doc site... http://www.php.net/manual/en/function.mysql-result.php Manoj Japher wrote: hi, I have started working with PHP-MySQL recently. I have been getting a warning message which i am not able to debug. Could some one pls help me out? The message is Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /usr/local/apache2/htdocs/verify.php on line 37 The code is @$db=mysql_pconnect(localhost:/var/lib/mysql/mysql.sock,,); if(!$db) { echo The Server is Busy. Please Try Later ; exit; } mysql_select_db(userinfo); $query = select * from userinfo; $mysql_results = mysql_query($query,$db); line 37:$num_result = mysql_num_rows($mysql_results); if($num_result == 0) { echo PInvalid Username or Password entered/P; exit; } Regards, Manoj 'I have miles to go before I sleep, and promises to keep' -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] HELP NEEDED!
Hi there I am having a problem querrying to my database. I wish to check to see if a username is listed in the database so that I can authenticate that individual. However, when I try to echo my $_result i'm always getting 0 can someone please help. I think it should be either 1 or 0. These are my scripts. This is my login pagepage ?php echo FORM name=_Form1 method=post action=test.php; echo TABLE border=1 width=300 height=300; echo tr; echo td valign=top; echo INPUT type=text value='' name=_Name1br; echo INPUT type=text value='' name=_Name2br; echo INPUT type=submit value='Submit' name=_submitButton; echo INPUT type=Reset value='Reset' name=_ResetButtonbr; echo /td valign=top; echo /tr; echo /TABLE; echo /FORM ? This is my script processor ?php file://Script processor mysql_connect(localhost, nik, playas) or die(Could not connect to the server); mysql_select_db(chronicleOnline) or die(Could not connect to the database); $_query = select userName from users where userName='_Name1' ; $_result = mysql_query($_query) or die(mysql_error()); if ( $_result = 0 ) { echo $_result; } else { echo $_result; } ? P.S. I have no problem putting the data into the database, just this query. Thx Nik -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Help needed - need to access a value from DB into all pages
Hi there, I am struggling with a concept and can't seem to find a way to do it so hoping you all can help. We want to use PHP with MySql Db. For security reasons on the DB, it is to be accessed only through this front end i.e. via the internal web Each user will have a number of levels of access to various parts of the system, so the obvious design is one where there is only 1 real login to the MySQL db (i.e. the system will auto log everyone in as this without them knowing it), and then the user is validated against a table in my DB which holds the access rights. I can get through the login OK, and get my table to return USERID for this person. Now I need that USERID available to ALL other pages so I can use it to determine what parts of screens to show, and what to allow them to do. My question is how do I make this variable available to all pages?? Do I have to include it with the variables passed to each page or is there a simpler way of doing it. Can I put the variable in an include file and include it in every page - will that work?. Surely someone must have had a similar situation before and can tell me how they solved it. Many thanks Janet -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Help needed on point system
Hi all, I am relatively new to php and mysql and would appreciate any help you can provide. Here is the task: I need to have a point system added to my site. What I would like is when a user logs in they will get 1000 points. But they only get it once per day. I am running: Xitami on WinME, PHP 4.06 and Mysql 3.23.43 win binary. If anyone is willing to help I will provide a database dump and any part or the script you will need. I would give the info now except I don't know what parts will be needed. Thanks for any help Regards Jerry -- 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]
[PHP-DB] Help needed with php and db2
Good day all, I am new to php and lucky me my boss has asked me to do a 'proof of concept' with php against IBM DB2. Our DB2 database resides on an OS/390 system. I'm just trying to figure out at this point if php can actually connect to our database on the OS/390. I've read about ODBC connectivity to db2, but it was on an apache/linux system...not a mainframe or enterprise system. Any thoughts anyone might have as to where I should start or even if this can truely be done I would greatly appreciate. Thanks in advance! Stephanie Workman Sr. Programmer/Analyst The University of Tennessee (865)-974-8108
Re: [PHP-DB] HELP NEEDED! SELECT of Text Fields in MS SQL Server 7.0 Limitatio n
Don't have any suggestions, but have these questions been asked: Presumably your query works just fine at the SQL Server console? What happens - the first 8k display, and then the rest of your page appears? Or do you get an error message? Timeout? What do you get? Are you hitting an array size limit? String size limit? Can you skip over the first 8k and fetch the remaining 8k? No answers, but some of these questions may turn up something. Miles Thompson At 12:47 PM 12/15/2001 -0600, Niko Spyridonos wrote: When trying to extract the contents of a text field in MS SQL Server 7.0 with PHP 4.0, I can only get up to about 8,000 characters of text out of them. Has anyone achieved to pull more data using PHP and if yes how? Thanks in advance. Niko Spyridonos Director of E-Business Services Chamerlik/CompuLogic http://www.designtech1.com/ T: (847) 679-5030 ext. 201 F: (847) 933-9413 C: (847) 980-7799 - Chamerlik/CompuLogic is standing strong against terrorism! -- 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] -- 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]
[PHP-DB] HELP NEEDED! SELECT of Text Fields in MS SQL Server 7.0 Limitation
When trying to extract the contents of a text field in MS SQL Server 7.0 with PHP 4.0, I can only get up to about 8,000 characters of text out of them. Has anyone achieved to pull more data using PHP and if yes how? Thanks in advance. Niko Spyridonos Director of E-Business Services Chamerlik/CompuLogic http://www.designtech1.com/ T: (847) 679-5030 ext. 201 F: (847) 933-9413 C: (847) 980-7799 - Chamerlik/CompuLogic is standing strong against terrorism! -- 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]
[PHP-DB] Help Needed !! -- Handling uploaded files by a script
Hi ... my name is Peter and I'm quite a rookie in PHP but not a total starter. ok ... in the file there is a form that contains one type file field... when I'm sending it to my script ... the is_uploaded_file() doesn't do anything... the variable ($pic_file) contains only the string with the path and file name of the file uploaded, with that \ is doubled \\ (I tried debugging) please tell me what I'm doing wrong.. .maybe there's something with the form ? or maybe it's the webserver that is messed up ? if someone could write a little piece of code that would handle the code...I would be greatful for emailing me I am using Win2000 with apache on it PHP 4.0.3 and mysql 3.23.28 thanx for help Peter - [EMAIL PROTECTED] begin 666 add.html M/%$3T-465!%($A434P@4%53$E#((M+R]7,T,O+T141!(5$U,(#0N,!4 MF%NVET:6]N86PO+T5.(CX-CQH=UL/@T*/AE860^#0H\=ET;4^861D M/]T:71L93X-CQL:6YK(')E;#TB4U193$532$5%5(@='EP93TB=5X=]C MW,B(AR968](G)UV@N8W-S(CX-CPO:5A9#X-CQB;V1Y()G8V]L;W(] M(B,P,# P,# B/@T*/9OFT@86-T:6]N/2)A90NAP(B!E;F-T7!E/2)M M=6QT:7!AG0O9F]R;2UD871A(CX-CQT86)L92!W:61T:#TB-#$P(B!B;W)D M97(](C$B(-E;QS%C:6YG/2(P(B!C96QL%D9EN9STB,(@8F]R95R M8V]L;W(](B,W-S@U138B(')U;5S/2)A;PB/@T*/'1R(%L:6=N/2)C96YT M97(B/CQT9!W:61T:#TB,3,P(B!C;%SSUH96%D97(^1G5L;!.86UE/]T M9#X\=0@8VQAW,]979E;CX\:6YP=70@='EP93TB=5X=(@;F%M93TB;F%M M92(@VEZ93TB-#0B(UAQE;F=T:#TB,S B(-L87-S/2)E=F5N(CX\+W1D M/CPO='(^#0H\='(@86QI9VX](F-E;G1EB(^/'1D(-L87-S/6AE861ECY- M86IOCPO=0^(#QT9!C;%SSUE=F5N/CQI;G!U=!T7!E/2)T97AT(B!N M86UE/2)M86IOB(@VEZ93TB-#0B(UAQE;F=T:#TB,S B(-L87-S/2)E M=F5N(CX\+W1D/CPO='(^#0H\='(@86QI9VX](F-E;G1EB(^/'1D(-L87-S M/6AE861ECY$;W)M($%D9')EW,\+W1D/B \=0@8VQAW,]979E;CX\:6YP M=70@='EP93TB=5X=(@;F%M93TB9]R;5]A91R97-S(B!S:7IE/2(T-(@ M;6%X;5N9W1H/2(R,(@8VQAW,](F5V96XB/CPO=0^/]TCX-CQTB!A M;EG;CTB8V5N=5R(CX\=0@8VQAW,]:5A95R/E!H;VYE($YU;6)ECPO M=0^(#QT9!C;%SSUE=F5N/CQI;G!U=!T7!E/2)T97AT(B!N86UE/2)P M:]N95]N=6UB97(B('-IF4](C0T(B!M87AL96YG=@](C(P(B!C;%SSTB M979E;B(^/]T9#X\+W1R/@T*/'1R(%L:6=N/2)C96YT97(B/CQT9!C;%S MSUH96%D97(^0V]N=%C=!F]T:5R/]T9#X\=0@8VQAW,]979E;CX\ MV5L96-T(YA;64](F-O;G1A8W1?8G)O=AEB(@VEZ93TB,2(@8VQAW,] M979E;CX-@D)3QO'1I;VX@=F%L=64](B(@4T5,14-4140^/3T]/3T]/3T] M/3T]V5L96-T()R;W1H97(]/3T]/3T]/3T]/3PO;W!T:6]N/@T*0D)/]P M=EO;B!V86QU93TB)DB/B1BF]T:5R6R1I73PO;W!T:6]N/@T*/]S96QE M8W0^/]T9#X\+W1R/CQBCX-CQTB!A;EG;CTB8V5N=5R(CX\=0@8VQA MW,]:5A95R/D1EV-R:7!T:6]N/]T9#X\=0@8VQAW,]979E;CX\=5X M=%R96$@8V]LSTB-#8B(')O=W,](C@B(YA;64](F1EV-R:7!T:6]N(B @ M(-L87-S/2)E=F5N(CX\+W1E'1AF5A/CPO=0^/]TCX-CQTB!A;EG M;CTB8V5N=5R(CX\=0@8VQAW,]:5A95R/E!I8W1UF4\+W1D/CQT9!C M;%SSUE=F5N/CQI;G!U=!T7!E/2)F:6QE(B!S:7IE/2(S,(@86-C97!T M/2)I;6%G92]J5G+EM86=E+V=I9B(@;F%M93TBEC7V9I;4B(-L87-S M/65V96X^/]T9#X\+W1R/@T*/'1R(%L:6=N/2)C96YT97(B/CQT9!C;VQS M%N/3(@86QI9VX]8V5N=5R(-L87-S/6AE861ECX\:6YP=70@='EP93TB MW5B;6ET(B!V86QU93TB061D(%)UVAE92(@8VQAW,];V1D/CPO=0^/]T MCX\+W1A8FQE/@T*/EN'5T('1Y4](FAI91E;B(@;F%M93TB;W B('9A M;'5E/2)D;VYE(CX-CPO9F]R;3X-@T*/]B;V1Y/@T*/]H=UL/@T*#0H- !@`` ` end -- 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]