Query Not Working In 5.0 That Worked In 4.0
I've created a development site for my website that uses mysql 5.0.18 and my live site uses 4.0.16. I have a query I can run without problems on the live site but is giving me errors on the development site and I was hoping someone might know what the problem is. It must be some change to the syntax standard I suppose. Thanks for your help!!!
1054 - Unknown column 'p.products_id' in 'on clause'
select count(p.products_id) as total from products_to_products as pp, products p, products_description pd, manufacturers m left join specials s on p.products_id = s.products_id where pp.products_id=�' and p.products_id = pp.related_products_id and pd.products_id=p.products_id and p.products_status = Ƈ' and pd.language_id = Ƈ' and m.manufacturers_id = p.manufacturers_id
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
ANDs In Query Not Working
I am working with this query: SELECT * FROM reviews WHERE gID = 'nothing' OR gID = '825' OR gID = '864' OR gID = '632' OR gID = '880' OR gID = '839' OR gID = '534' OR gID = '680' OR gID = 'x' AND type = 'online' AND status = '1' ORDER BY RAND() LIMIT 0, 10 With everything going on here, the most important is that only rows with status=1 are selected. However, I am getting some rows with status=0 in my results. Is there something wrong with the ANDs in my query?
Simple Mysql Query Not Working
I have a simple table set up listing stockists and there details, included in this table I have a name column and a website column. I wish to select the name and the website of the stockists only if a website has been entered into the website column. Here is the query I have tried to use Quote: SELECT name, website FROM stockists WHERE website IS NOT NULL ORDER BY name ASC This query is returning stockists with no website as well as the ones with websites and I don’t know why!
Query Of Gmdate Not Working... Is My Syntax Correct?
$query="SELECT distinct(id),subject,view, postdate FROM threads where gmdate(Y-m-d H:i:s, postdate + 3600) >= date_sub('".$current_date."', interval 7 day) order by view desc limit 0 , 5 "; I tried to get my postdate to compare with the current date in order to display the most view topic in last 7 days in my page... however, the above coding is not working...
Query To Display The Rows As Colums Is Not Working!!
I want a select query to get two columns. but i need to get these columns one below the other that is consider that i have a table student in that i have 2 columns name mark. Now i want the result as Name Raj Rina Tina Marks 80 90 70 I tried the --vertical option of mysql and G option in the query. for example when i tried select *from studentsG it displayed *********** 1. row *********** name: Raj marks : 80 ********** 2. row ************ name: Rina marks : 90 ********** 3. row ************ name: Tina marks : 70 but i want to display Name Raj Rina Tina Marks 80 90 70
Order By Not Working Correctly, Query Problem?
I am using the following query to get a list of anime names and related info from my mysql db. As anime are sometimes known by several names (the actual japanese kantakana/kanji, the romanji translation and the english word). So the info_anime table has all the info about the anime and the info_animename just has the relevent animeid and the name. The query below is ment to check all the names in info_animename and join them to info_anime. SQL SELECT n.*, a.* FROM info_animename AS n, info_anime AS a WHERE a.animeid = n.animeid ORDER BY ".$_GET[orderby]." ".$_GET[order]." Now all the names are displayed properly with the various info but if you look here: Live Anime - Anime List You will see that the names are not in alphabetical order, for the most part they are just anime with several names are not working correctly if you look at the bottom of the page you will see: Yakusoku no Basho Kumo no Mukou followed by Beyond The Clouds, The Promised Place Which are the same anime under different names.
Query Cache Not Working: MySQL 5 / Windows XP
I just installed MySQL 5, and its running great except that the query cache is not working, despite the configuration excerpt from my "my.ini" below: query_cache_size=5M query_cache_limit=2M query_cache_min_res_unit=4096k query_cache_type=1 From the MySQL command line, if I enter: SHOW VARIABLES LIKE 'have_query_cache'; I get: +------------------+-------+ | Variable_name | Value | +------------------+-------+ | have_query_cache | YES | +------------------+-------+ Also, doing a: SHOW STATUS LIKE 'Qcache%'; gives me: +-------------------------+---------+ | Variable_name | Value | +-------------------------+---------+ | Qcache_free_blocks | 1 | | Qcache_free_memory | 5234168 | | Qcache_hits | 0 | | Qcache_inserts | 0 | | Qcache_lowmem_prunes | 0 | | Qcache_not_cached | 450 | | Qcache_queries_in_cache | 0 | | Qcache_total_blocks | 1 | +-------------------------+---------+ I figure the "Qcache_free_blocks" and "Qcache_total_blocks" values of 1 are creating the problem; it's basically telling me that there are no (okay, 1) free blocks to put my query. However, these values never change. The query cache is not vital to me, but it does improve performance, and I'd like to get it going....
!= Not Working?
SELECT d.cache_diff, d.cache_name, d.cache_type, d.cache_last_found FROM geocaches d LEFT JOIN logvisit ON d.cache_id=logvisit.cache_id WHERE d.cache_status = 0 && logvisit.log_type != 'Found' && logvisit.log_owner_id = 64 This returns zero rows. Its true that records in logvisit.log_type for this user are only FOUND but I am trying to display cache information for all other caches (in geocaches table) that the user did not log FOUND in logvisit. So, basically if the user logged against 3 caches and there are 10 caches available to log agains then I want to display only the remaining 7. Is JOIN the way to go on this one?
LIKE '[0-9]%' Not Working
Here is the SQL query: Code: SELECT * FROM member WHERE username LIKE '[0-9]%' Returns 0 rows. I've tried this on 4.1.7-nt as well as 4.0.22-standard; neither work. And yes, there are records in the table that should match that pattern.
Not Working
I have 4.1.10a on my local machine and the following WHERE clause works fine: Code: WHERE wk1 IN (select max(wk1) from wkpts where teamid = w.teamid) But when I upload it to my web site, I get an sytax error at 'select max(wk1) from...' My web host has MySQL version 4.0.20-standard. Can someone tell me why it would work locally, but not on my web host's server? Thank you.
LIKE '%$var%' Not Working
I am trying to create an sql statement to return values on either side of the variable. Code: $sql = "SELECT * FROM principals LIKE companyName = '%{$_POST['companyName']}%'"; The error was: Error: 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 'LIKE companyName = '%Mike%'' at line 1
Select As Where Not Working!
SELECT CONCAT(RIGHT(dt,4),'-',MID(dt,4,2),'-',LEFT(dt,2)) AS dateavail FROM atable WHERE dateavail = ��-06-01' (dt is a date in format dd/mm/yyyy - the concat bit works fine) Microsoft OLE DB Provider for ODBC Drivers error ?e14' [MySQL][ODBC 3.51 Driver][mysqld-4.1.19-standard-log]Unknown column 'dateavail' in 'where clause' Also, if I get it to work, how do I convert the 2 strings to date so I can look for < and > ?
Doing A JOIN Not Working
I have 2 tables, one contains columns that holds the ID to the other table so eg Table 1 (images) id | imagepath -------------- 1 dir/hair.png 2 dir/face.png Table 2 (buildImages) userid | hair | face 1 1 2 So i'd just like to retrieve a row like dir/hair.png, dir/face.png where userid = 1 does that make sense? Oh, the title of this thread is kind of wrong, shoudl be how do I do this join :P
DATE_SUB() Is Not Working Right For Me.
My `date` column is in date/time format 2007-12-14 19:55:00 When I try to select only the records added in the last 5 hours, I get records from more than 24 hours ago. I know I am EST zone and the server is PST zone, but something else is wrong. This is my WHERE clause: WHERE `date` > DATE_SUB(CURRENT_DATE, INTERVAL 5 HOUR)
Working With SET Type ...
I have this SET(Ƈ',ƈ',Ɖ',Ɗ') on a column. Suppose that the colunm has the data (1,2,4) Now i want to select rows that contain either 1 or 2 or 4. What is the fastest way to do this ?
Left(str. Len) Not Working!
BTW: I am very new to PHP & MySQL learning from the site point book ("Build your own database driven website!"). My Question If i use the left function from the command line, the expected result is returned ok, however when i apply the same query to my web page nothing is returned. This is my query: $sql = "SELECT date_added, short_desc, LEFT(long_desc, 10), news_ID, loc_id FROM location Inner Join news ON globalisation = loc_id WHERE loc_id = Ƈ' ORDER BY news_ID ASC"; $getRows = @mysql_query($sql); if (!$getRows) { exit('Error: Loading SQL statements: '.mysql_error()); } while($listedItems = mysql_fetch_array($getRows)) { $id = htmlspecialchars($listedItems['news_ID']); $news_short = htmlspecialchars($listedItems['short_desc']); $news_long = htmlspecialchars($listedItems['long_desc']); $date_added = htmlspecialchars($listedItems['date_added']); echo '<div class="row_container">' echo '<div class="col_1">' . htmlspecialchars($id) . '</div>' echo '<div class="col_2">' . htmlspecialchars($news_short) . '</div>' echo '<div class="col_3">' . htmlspecialchars($news_long) . '</div>' echo '<div class="col_4">' . htmlspecialchars($date_added) . '</div>' echo '<div class="col_5"><a href="edit_news.php?id=' . $id .'">Edit<a/></div></div>' }
DISTINCT() Not Working
Does anyone have any idea why i can't get this to return distinct values? PHP SELECT DISTINCT(agi.userid), agi.imageid, agi.title, agi.dateline, agi.catid, agi.thumbname FROM a_gallerys_images agi WHERE agi.valid = 1 AND agi.open = 1 AND agi.catid = 2 ORDER BY agi.dateline DESC LIMIT 4
MAX(mainid) Isn't Working For Me???
I am wanting to get the last inserted mainid number then insert back into a different row at a higher number. For example if the inserted mainid was 1 the next number should be 2. The code below isn't working for me. It just adds 0 to the mainid column. Can someone please tell me if there is a better way of doing this? Thanks in advance. Here is my PHP require "config.php"; // more code here $insert1 = "INSERT INTO `menu` (`mainid`) SELECT max(mainid) + 1 FROM menu"; if (mysql_query ($insert1)) { $query1 = mysql_query("SELECT LAST_INSERT_ID() as id FROM menu") or die ("Could not query because: ".mysql_error()); $row1 = mysql_fetch_assoc($query1); $id1 = $row1['id']; $update1 = "UPDATE menu SET menu = '$menu', pagetitleMenu = 'Menu', pagetitle2 = '$pagetitle', pagetitleSub = 'none', subid = Ɔ', submenu = '$submenuyesno' WHERE mainid = '$id1'"; // more code here mysql_close();
Queries Not Working
its been ages since I have worked with MySQL so I am very rusty and am just trying to patch together loads of old code at the moment. $dbh=mysql_connect ("localhost", "*********", "************") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("*********"); $result = mysql_query("SELECT * FROM Update WHERE number=Ƈ'); $row = mysql_fetch_array($result); echo $row['title']; mysql_close($dbh); I keep getting this message: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/dcaggorg/public_html/update/index.php on line 18
Working With Dates
After taking a break from this project for a bit I find myself confused about how to pull specific date periods from a database. The timestamps are stored in UNIX format. I'm creating a report builder to pull details about issues that my techs have entered (ISP support center). I can pull reports from calls entered today or yesterday, but getting them from say, mon-fri of last week is throwing me for a loop. Can anyone point me in the right direction? This is what I have thus far: //echo "DateRange: ".$daterange."<br>"; // begin building our query $query = "SELECT * FROM issues WHERE "; // the value passed in date range is how we modify the date lookup in our SQL query if ( $daterange == "today" ) { $timestamp = strtotime("today"); $query .= "DATE_FORMAT(CURDATE(), '%Y%d%m') = FROM_UNIXTIME(issue_submitted_date, '%Y%d%m');"; } else if ( $daterange == "yesterday" ) { $query .= "DATE_FORMAT(CURDATE() -1, '%Y%d%m') = FROM_UNIXTIME(issue_submitted_date, '%Y%d%m');"; } else if ( $daterange == "thisweek" ) { $query .= "DATE_FORMAT(CURDATE() -7, '%Y%d%m') = FROM_UNIXTIME(issue_submitted_date, '%Y%d%m');"; } else if ( $daterange == "lastweek" ) { $query .= "DATE_FORMAT(CURDATE() -14, '%Y%d%m') = FROM_UNIXTIME(issue_submitted_date, '%Y%d%m');"; } else if ( $daterange == "thismonth" ) { $query .= "DATE_SUB(CURDATE(),INTERVAL 1 MONTH) >= issue_submitted_date;"; } else if ( $daterange == "lastmonth" ) { $query .= "DATE_SUB(CURDATE(),INTERVAL 2 MONTH) >= issue_submitted_date;"; } else if ( $daterange == "thisyear" ) { $query .= "DATE_SUB(CURDATE(),INTERVAL 1 YEAR) >= issue_submitted_date;"; } else if ( $daterange == "lastyear" ) { $query .= "DATE_SUB(CURDATE(),INTERVAL 2 YEAR) >= issue_submitted_date;"; }
Fulltext Example Not Working
I'm trying fulltext searching for the first time [Ver 12.22 Distrib 4.0.17, for pc-linux (i686)], but I can't figure out why the example in the mySQL manual is *not* working. mysql> SELECT * FROM articles -> WHERE MATCH (title,body) AGAINST ('database'); Empty set (0.00 sec) mysql> SELECT id, MATCH (title,body) AGAINST ('Tutorial') -> FROM articles; +----+-----------------------------------------+ | id | MATCH (title,body) AGAINST ('Tutorial') | +----+-----------------------------------------+ | 1 | 0 | | 2 | 0 | | 3 | 0 | | 4 | 0 | | 5 | 0 | | 6 | 0 | +----+-----------------------------------------+ 6 rows in set (0.00 sec)
Subquery Not Working
CODESELECT parexel_staff.name, parexel_skills.skill, parexel_activity.date FROM parexel_staff, parexel_skills, parexel_activity WHERE parexel_staff.name = parexel_activity.name AND parexel_activity.skill = parexel_skills.skill AND parexel_skills.skill = 'CGI' AND CURRENT_DATE > (parexel_activity.date + INTERVAL parexel_skills.retake MONTH) AND parexel_staff.name NOT IN ( SELECT parexel_staff.name FROM parexel_staff, parexel_skills, parexel_activity WHERE parexel_staff.name = parexel_activity.name AND parexel_activity.skill = parexel_skills.skill AND parexel_skills.skill = 'CGI' AND CURRENT_DATE < (parexel_activity.date + INTERVAL parexel_skills.retake MONTH) );
Character Set Not Working
I am using 5.0.24 max on my RedHat 8.0. Having problems inserting persian character set into my database. After searching around and doing what was recommended, I still got no where. I am using a firefox -> PHP -> mysql to enter and read data. Reading data from the command line results in garbage. Here is some useful info: mysql> show create database mytest; +----------+-----------------------------------------------------------------------------------------+ | Database | Create Database | +----------+-----------------------------------------------------------------------------------------+ | mytest | CREATE DATABASE `mytest` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_persian_ci */ | mysql> show create table binfo3; | binfo3 | CREATE TABLE `binfo3` ( `id` int(11) NOT NULL auto_increment, `year` varchar(8) collate utf8_persian_ci default NULL, `make` varchar(15) collate utf8_persian_ci default NULL, `model` varchar(20) collate utf8_persian_ci default NULL, `miles` int(11) default NULL, `price` int(11) default NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=100009 DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci | mysql> show variables like 'character_set%'; +--------------------------+--------------------------------------------------------------+ | Variable_name | Value | +--------------------------+--------------------------------------------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | latin1 | | character_set_system | utf8 | | character_sets_dir | /usr/local/mysql-max-5.0.24-linux-i686/share/mysql/charsets/ | Here is how I connect the DB: # cat opendb.php <?php // This is an example opendb.php $conn = mysql_connect($dbhost, $dbuser, $dbpass ) or die ('Error connecting to mysql'); mysql_select_db($dbname); mysql_query("SET CHARACTER SET UTF8"); mysql_query("SET NAMES utf8"); mysql_query("SET CHARACTER_SET_RESULTS=NULL"); ?> In my browser after entering the data I echo the data and it appears fine. I read it back from the DB and its garbage like: ID:100008 Year:۱& Make:بن& Model:۲۲۰ Kilometer:0 Price:0 The & is not suppose to be there. Only 1 char from Year is appearing and 2 chars from the Make appearing. But Model looks fine! Kilometer and price are not accepting any inputs!
SELECT Not Working
SELECT U.*, G.Name AS groupname, C.FirstName, C.LastName, (Select count * from Account Acc where Acc.User_ID = U.User_ID) as Account_ID FROM ((Users U LEFT JOIN Groups G ON U.Group_ID = G.Group_ID) LEFT JOIN Customers C ON U.Customer_ID = C.Customer_ID) WHERE 1 = 1 The above returns a 1064 Error on SUSE Linux MySQL 4.0.18. But on WinXP MySQL5.0 all runs fine. Can anyone give me advice on how to fix the above to work? If I remove the second select from the query all works fine.
PHP Not Working With MySQL
Just starting out and I have PHP, Mysql, and Apache installed. PHP and MYSQL dont seem to be working together. Everything seems to be running fine and I edited the httpd.conf in order to allow apache to process php requests. This is what I am doing when I start mysql... c:/net start mysql c:/mysql/bin/mysql -u root -p Then I log in and it accepts the log in. When I create a sample php program like "Hello", it works. But when I do a simple sql connect: <?php $conn = mysql_connect("localhost","root","tntboy"); echo $conn; ?> I get nothing! Nothing at all comes up on the screen. Any ideas? Why is it not connecting to the database?
UPDATE Not Working.
The page that sends information to the following page has a series of text inputs. The name of the input corresponds to the name of the column in the in the mysql table. There's also a hidden input, "id", that supplies the unique id number of the entry. My script to enter data into the table and to view the table work fine. The update script runs without any errors, but doesn't alter any values. I also tried printing the value of $query and everything appears to be fine. Anyone know why this is happening? Code:
Foreign Key Not Working
I am using mysql server 5 version, and heidisql version 3.0. i am adding a foreign key to an already existing table the exact command is ALTER TABLE mailer_contact_details ADD CONSTRAINT mcd_fk FOREIGN KEY (address_id) REFERENCES addresses(id) on delete set null there is no error, and i am getting query ok, but the foreign key functionality is not happening, i am able to enter the value in the child table which is not present in the parent table, and still no error message is getting displayed i even created an index for address_id field, and then again giving the above command, still foreign key functionality is not working.. where is the problem?
INSERT Not Working
I have the following: mysql_query("UPDATE tblmembers SET loginDateTime = NOW(), MemberApproved='A' WHERE ID = '".$_SESSION['mid']."'"); mysql_query("INSERT INTO tbllogins (MembersID, loginDate) VALUES('".$_SESSION['mid']."', NOW()"); The top line works perfectly, UPDATE'S both columns in table tblmembers, the second line doesn't work at all... It isn't INSERTing any data into tbllogins...
Still Cannot Get MySQL Working
I have the MySQL server running. I have installed MyODBC. I cannot get either the Migration Toolkit or the MySQL Administrator to connect. I've turned off the Windows Firewall and put exclusions in Norton to allow port 3306 and MySQL. With the MySQL Administrator I get an error message of Cannot Connect to MySQL Server on localhost. With the Migration Toolkit I get this error log: Code:
Mysqldump Not Working
I created a backup of my databse using: mysqldump --opt mydb > "c:ackup.sql" when I try to restore the database with mysql mydb < "c:ackup.sql" I get an error saying 'c:ackup.sql' incorrect database name.....
No Timestamps Working
I've tried just about every php/mysql combination out there in order to make this work, but even when it seems that it should work, it doesn't. It must be comparing strings or something, because I've tested the numbers, and the numbers themselves would have worked properly. What I'm trying to do is create a "Who's Online" box for a forum. I've already created a timestamp record in my user table, and they're updated with NOW() whenever somebody navigates anywhere on the site. I've tried to run this with many functions, and the most recently failed one is this: $query = "SELECT recorda, recordb FROM usertable WHERE timestamp >= " . (date("YmdHi") - 10) . date("s"); $result = mysql_query($query); ...
Working With Dates...
How would I finish a query like this: SELECT * FROM table WHERE datetime_field BETWEEN NOW() AND <tonight at midnight> I'm not sure how to calculate "tonight at midnight" in a format that can be compared to the result of NOW(). Any ideas?
NOT NULL - Not Working
I have created an HTML page that has an Iframe on it, linked to a PHP page. When I refresh the HTML page (and thus the PHP page), it will resend the code to MySQL, creating a blank row (except date, which is automatically entered by a variable with the PHP date() command), even if the HTML forms yield no value. Here is the code: CREATE TABLE withdraw ( id int NOT NULL auto_increment, reason varchar(20) NOT NULL, amount decimal(8,2) NOT NULL, date varchar(20) NOT NULL, primary key (id));
Working With 'SET'
I would like to know how I can work with a PHP Array and a set. How can i get all rows where a set where at least one item oft the php Array is inside the set column?
AUTO_INCREMENT NOT WORKING
I have set all my foreign keys to AUTO_INCREMENT, but when I insert a new record I have to insert the next number manually. Does anyone know why the number isnt automatically incrementing?
Working With Images.
mysql 4.0.24 I have an existing database that has image information. It stores the path, filename and some other items. I'd like a way to store the thumbnail of the image in the database. I still want the image as a file. I'm having troubles figuring out exactly how to add the thumbnail. I can manually use convert to create the thumbnail. What I've found on the net are just methods for uploading a single image, then adding it to the db. This will be a one time shot to update the DB. Pick a language, I'll figure something out if I can get the key to this.
Recordcount Not Working = -1
Why wont this work? The Recordcount is > 90. I can get the records, do select, update, and delete. WinXP pro ASP 3.0, VBscript MySQL ODBC 3.51 Driver MySQL 5 code: <% Set DBConn = Server.CreateObject ("ADODB.Connection") DBConn.Open emailDSN set RS = Server.CreateObject("ADODB.Recordset") sqlQuery = "select * from web_email" RS.Open sqlQuery, DBConn, 3, 1 Response.Write("<h1>Recordcount = " & RS.Recordcount & "</h1>") RS.close set RS=nothing DBConn.Close set DBConn = nothing %>
My Cursors Are Not Working
I have this code: create procedure pruebacursor () begin declare a char(5); declare done int default 0; DECLARE cur1 cursor for select substring(link,1,3) from animals; DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done=1; open cur1; repeat fetch cur1 into a; insert into names values (a); until done end repeat; close cur1;
Not Working As Expected
All i need is to insert data from the disk to a table. The Text File: 30434 menios 30567 dimitris 30666 skatas 30123 testing SQL syntax: mysql> load data local infile 'c:sub.txt' into table m; Query OK, 4 rows affected (0.00 sec) Records: 4 Deleted: 0 Skipped: 0 Warnings: 0 mysql> select * from m; +-------+-----------+ | am | name | +-------+-----------+ |434 | menios |30567 | dimitris |666 | skatas | 30123 | testing | +-------+-----------+ 4 rows in set (0.00 sec) Why is that happening? - my PC: MySQL last version (5. ..), win32 - It works fine under linux! 'Describe' of m table mysql> describe m -> ; +-------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+-------+ | am | int(11) | YES | | NULL | | | name | varchar(10) | YES | | NULL | | +-------+-------------+------+-----+---------+-------+ 2 rows in set (0.00 sec)
Limit Is Not Working
I have created a trigger: I am using if not exists(select field1,field2 from table1 where name1=?name and section1=? section limit 1) then .....start insert process......on a certain table end if; I am using limit 1 to return only 1 row to start insertion, but it seems that limit doesn't work when we are using if not exists... If anyone has any other suggestion, it would be great. Also I used: but it doesn't work with this var variable: ///////////////////////////////////////////////////////////////////////// declare var varchar(400); set var=null; set var=select field1,field2 from table1 where name1=?name and section1=? section limit 1; //why set it doesn't work here, to check nullity if(var=null) then //we check nullity like this?????????? insert into table 2(field11,field22) values( 'x','y'); end if;
PhpMyAdmin Isn't Working
OK, phpMyAdmin can't create a table, it produced this code: CREATE TABLE `photos` ( `name` VARCHAR( 255 ) NOT NULL , `desc` TEXT( 500 ) NOT NULL , `url` VARCHAR( 255 ) NOT NULL , `cat` INT( 4 ) NOT NULL , `id` INT( 4 ) NOT NULL , INDEX ( `name` , `desc` , `url` , `cat` , `id` ) ) and this error: MySQL said: #1064 - 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 '(500) NOT NULL, `url` VARCHAR(255) NOT NULL, `cat` INT(4) NOT N .
Select Where Not Working
i've been testing on a select statement on mySql 4.0.18 with the following statement and it worked fine $result = mysql_query("SELECT * FROM rate WHERE 1 AND country LIKE 'Kenya' LIMIT 0, 30",$db); however i'm now using a friend's isp and they have mySql 4.0.20 and the statement above doesn't work, a select * from rate however does work.I need to select a specific country from a single table and output the results onto the screen.
Rand() Not Working In Php?
I'm trying to get the rand from the mysql. When I use the MySQL Front software (SELECT * FROM keyword ORDER BY RAND() LIMIT 2, it gives me random which is working fine. But when I use the php and it doesn't give me random. What wrong with php? $query = "SELECT * FROM keyword ORDER BY rand() LIMIT 2"; $result = mysql_query($query) or die("Query failed : " . mysql_error()); echo "<PRE>"; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { print_r($line); } echo "</pre>"; mysql_free_result($result);
Why Isn't Load_file() Working
Today I learned how you're supposed to put pictures and other binary data into databases. Problem is, no matter if I use load_file('pic.jpg') or a script-side method, the value in the db ends up NULL. Why is this? I've verified it is null by running the "is null" statement. I have the picture in the same folder as the /bin dir, so the command "insert into... pic=load_file('pic.jpg') sholud work. Can anyone tell me why it's not? This doesn't just happen with pictures btw. Why won't it import? I'm doing this as root user, by the way.
Working With Relevance
I'm trying to put up a search engine in my website, using MySQL fultext search capabilities. I can handle the queries, but I'm puzzled by the "relevance" parameter. What are the values I should expect in this index? I know I can get 0 (where no match is found) and value increases up to... 1? More than 1? Yes, I sometimes got values higher than 1. I even think I sometimes got higher than 3 or 4. So this is not a correlation. What is it then? How do I use it to retrieve a percentage or to draw a longer bar when results are more pertinent? Has anybody any clue about what the numbers in the "relevance" field may mean when using MATCH AGAINST ?
UCASE Not Working
I have to change some rows to be uppercase. I recently changed the column I'm trying to work with to VARBINARY because I'll need to support case sensitivity soon. Before I do that I need to make everything currently in this column uppercase, so: Code: SELECT UPPER(patientID) AS pID FROM prescriptions WHERE something... gives me the expected results, but not in uppercase!
Mysql Not Working
im trying to install bugzilla (im on rh9) ive gotto the point where you run ./checksetup.PL. Thing is its saying it cant connect to the database - but the database is there and the settings n the config files are right.
|