mysql

MySQL+PHP: Can anyone tell me what is wrong with this code?

I am having problems running this script, but i keep on getting the same error message. Could someone point out where I am going wrong? Thanks. Error message: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 $datenow = date("Y-m-d") . "...

Retrieving the 25 most recently added entries from all tables in a MySQL database

Hello, I have a MySQL database (named "sitefeather") which will eventually have several tables with identical structures. The structure is this: id INT(11) NOT NULL auto_increment, site VARCHAR(1000) NOT NULL, action1 BIGINT(9) NOT NULL, action2 BIGINT(9) NOT NULL, createddatetime TIMESTAMP DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY(id), ...

Parsing vCards on web pages into a MySQL DB

I have a client who is using a separate vCard on a separate page. These are being pasted into a wordpress text field. (Not the most efficient way to maintain a list of people, but I won't editorialize after the fact.) My mission is to write something to parse through all the addresses in the vCards and to dump the information into a c...

GROUP_CONCAT and LEFT_JOIN issue - Not all rows returned

Let's say my DB Scheme is as follows: T_PRODUCT id_product (int, primary) two entries: (id_product =1) , (id_product =2) T_USER id_user (int, primary) id_product (int, foreign key) name_user (varchar) two entries: (id_product=1,name_user='John') , (id_product=1,name_user='Mike') If I run a first query to get all products with their...

PHP+MYSQL: Problem with Update query

Hi, I'm having problems running this query. I keep on getting the 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 'read = 'readd' WHERE user_id = '1' LIMIT 1' at line 1 The code $conn = mysql_connect('localhost', 'admin', 'root') or die(m...

Automate database table creation from within CakePHP framework

I'm trying to write a webapp with CakePHP, and like most webapps I would like to create an installer that detects whether the database has been initialized and, if not, executes the installation process. This process will be entirely automated (it assumes the database itself already exists, and that it is granted full administrative acc...

FreeBSD, MySQL, Perl, bash: intermittent blocking on named pipes?

This is weird and I'm not sure who the culprit really is. I'm doing some scripting, on FreeBSD (6.2)? which makes extensive use of the following bashism: do_something <(mysql --skip-column-names -B -e 'select ... from ... where ...;') ... where "do_something is a somewhat crufty utility (in Perl) that won't read from a pipeline. If ...

how to display data in two column with php

How can I display data in two columns? <?php $query = "SELECT * FROM `release` WHERE artist_id = '$rcode' AND label_id = '$id'"; $result = mysql_query($query); $tr_no = mysql_num_rows($result); while ($info = mysql_fetch_array($result)) { ?> <div> <table style="width: 100%"> <tr> <td ><img src="../artwork/...

Double While loop not working

Based on advice that I have been given on StackOverflow, I tried the query below but it did not work. I'm trying to get a list of the 25 most recently-added values for "site" in the database, regardless of what table they are in. The code below give the following error: Warning: mysql_fetch_array(): supplied argument is not a valid My...

[MySQL]: What is collation method?

When I use phpMyAdmin to see my online tables, it uses collation method "latin_swedish_ce". Why? What is the default? And, for what collation method is used? ...

SQL: Insert only new rows/records into a table?

I'm parsing a json feed routinely and need to insert only the newest users from the feed and ignore existing users. I think what I need is ON DUPLICATE KEY UPDATE or INSERT IGNORE based on some searching but I'm not quite sure which is why I'm asking - so for example: users 1 John 2 Bob Partial JSON: { userid:1, name:'John' ...

How does one do a multi table UPDATE in MYSQL 5.1 using ‘ORDER BY’ and ‘LIMIT’ statments

I have two tables Events and FixedPlace CREATE TABLE `events` ( `idEvents` int(10) unsigned NOT NULL AUTO_INCREMENT, `NumberOfPlaces` int(10) unsigned DEFAULT '0', `FpOddsPrice` double DEFAULT '0', PRIMARY KEY (`idEvents`), ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1; /////////////////////////////////////////////...

Database design for custom form builder (and storage of results)

I'm trying to implement a custom form builder, similar to those provided by Wufoo and Google. While I've created a simple UI to create these custom forms with, my issues lie in the database design. Upon creating the form, a JSON implementation is saved in the database (would like to improve this) and referenced to build the form that a ...

Mysql advanced statement

I am having trouble with the following MYSQL query and are hoping that there is someone that can help me with it. Here is the query: SELECT * FROM dbcasino_db22.tb_content WHERE content_real_folder = 'foldername/' AND content_no < 5099 This query works but gives me all the records smaller than 5099 that match the content_real_folde...

mySQL - A new table of each page?

Every page on my application will display 1000 records and they are only needed on that page. Is it more efficient to have one huge table with an additional 'page id' column or to have a new table for each page? I imagine accessing data from a single small table would be easier than a huge one but it will make the database a bit of a m...

WordPress Database Backup Question

I am working on a charity site and was tasked with moving a WordPress site to another host from Yahoo hosting. I have done this before and thought it would be easy enough. Before moving the site I backed up all the files and backed up the database. The files are fine, but the database backup has me stumped. I ended up with the followin...

SQL and VISUAL BASIC 2008 Queries

Hello guys, How can I write a sql query that takes information from a database, and then put in the text in a label? I'm not really sure how to do this so please give me a good explanation! :) Thanks, Kevin ...

Generate int primary key manually in mysql

Hello. What is the best way to generate a manually int primary key with mysql? I dont want to use the autoincrement feature. I taught to create a table with one column of type int named sequence. So every time I'm going to insert a new record first check this column and use the value as the primary key. Then after the insert is success...

Why my table doesnt support FOREIGN KEYS?

I have made a database and 10 tables in mysql(table type NONE) and i can't create foreign keys. An alert message says SQLyog The selected table does not support foreign keys. Table engine must be InnoDB, PBXT or SolidDB Will i must alter all of my tables now? thanks for any hint or suggestion ...

Mysql GROUP_BY issue (active record)

What I'm trying to do in the query below: questions are posted that belong to 1 continent and 1 country. Answers are posted to these questions by a user. In the query below I get all that data and the number of answers. The issue is that the COUNT(answers.text) returns a number of 1 when it should actually be zero. This is in case ther...