I want to be able to search through a MySQL table using values from a search string, from the url and display the results as an XML output.
I think I have got the formatting and declaring the variables from the search string down.
The issue I have is searching the entire table, I've looked over SO for previous answers, and they all see...
I want to ask about UNIX time, Does UNIX time record Timezone?
I moved my hosting from Chicago/America to JST.
The problem is that my whole MySQL database has records of UNIX time (Chicago/America timezone)
I have a PHP code to show the time ago (ex 3days ago, yesterday, etc)
When I move to the new server it says tomorrow
To avoid th...
I have a fairly simple insert statement
<...>
if (!empty($attributes)) {
$sql = 'INSERT INTO `part_attrs` (`part_id`, `attr`, `type`, `list_order`) VALUES (?, ?, ?, ?)';
foreach($attributes as $key => $attribute) {
$this->db->query($sql, array($partid, $attribute[0], $attribute[1], $key));
...
My classifieds website uses mainly PHP and MySql.
On error, (for example if a variable isn't found), I would like to have an error-page to show, is this possible? And I mean for every error to point to the same error-page.
I am thinking about htaccess, but maybe there are other ways also?
Same with MySql, how is it done there?
Thanks...
Whats wrong with this SQL? It should return results but returns nothing
SELECT `pid`
FROM `products`
LEFT JOIN `prods_to_features`
ON (`ptf_pid` = `pid`)
WHERE ( `ptf_id` = '66'
OR `ptf_id` = '67'
)
AND (`ptf_id` = '76')
Is it not possible to have the 2nd where clause for the table that has been used...
Hi,
I have a stored procedure below. I intend this procedure to return the names of all the movies acted by an actor.
Create Procedure ActorMovies(
In ScreenName varchar(50),
OUT Title varchar(50)
)
BEGIN
Select MovieTitle INTO Title
From Movies Natural Join Acts
where Acts.ScreenName = 'ScreenName ';
End;
I mak...
I'm porting some stored procedures from Informix to MySQL, but I have two stored procedures on Informix that have same name and different parameters.
In MySQL, I can't create two SP with the same name, and also can't create a SP with default values in parameters.
so, do someone out there know any hackery or black magic that may help me...
Hi i am developing a web app.I am retrieving options of the select box from database and i want to write these records to selectbox.My page structure is like that:
main.php=>there is a selectbox in this page <select id="my_select"></select>
retrieve_data.php=>i make a ajax call to this page and this page gets the phone numbers from ...
I can't remember what the method is meant to be for ensuring the scope of a variable in a query is restricted to prevent mysql injection.
where should i put brackets in the following examples?
UPDATE table SET col_1 = '$var', col_2 = '$var2' WHERE col_1 = '$var3'
and
SELECT * FROM table WHERE WHERE col_1 >= '$var1'
(Obviously look...
I have there mysql table:
**product (id,name)**
1 Samsung
2 Toshiba
3 Sony
**attribute (id,name,parentid)**
1 Size 0
2 19" 1
3 17" 1
4 15" 1
5 Color 0
6 White 5
7 Black 5
8 Price 0
9 <$100 8
10 $100-$300 8
11 >$300 8
**attribute2product (id,productid,attributeid)**
1 1 2
2 1 6
3 2 2
4 2 7
5 3 3
6 3 7
7 1 9
8 2 9
9 3 10
And listed...
i must get data from four tables. i wrote the script with four queries, but i use it in ajax, and i wan't to do it by one query.
here is queries...
$query1 = "SELECT `id`,`name_ar` FROM `tour_type` ORDER BY `order`";
$query2 = "SELECT `id`,`name_ar` FROM `hotel_type` ORDER BY `order`";
$query3 = "SELECT `id`,`name_ar` FROM `food_type` O...
Hey guys,
i was searching SO for help on this, but i can't seem to find a concrete solution.
Is, or isn't it possible to connect to a mysql database with Cocoa?
Because i'm working on a program that i'd like to extend to a database, but i sure as hell don't know how!
I mean, that cocoa-mysql package is heavily outdated, and i dont even ...
I got this odd error and I can't figure out where it came from:
Warning: mysql_query(): 3 is not a valid MySQL-Link resource in (...)
What's up with the 3? I don't get it. Has anyone experienced this error themselves?
...
I setup ruby and mysql on my mac and i am having issues connecting to my local mysql server.
require 'rubygems'
require 'mysql'
...
db = Mysql.new("localhost", "root", "", "")
...
This would give me the following error when i run this script fromt he command line:
generate.rb:37:in `initialize': wrong number of arguments (4 for 0...
Hello,
this question may seem too basic to some, but please bear with be, it's been a while since I dealt with decent database programming.
I have an algorithm that I need to program in PHP/MySQL to work on a website. It performs some computations iteratively on an array of objects (it ranks the objects based on their properties). In e...
This is part of my TV guide script:
//Connect to the database
mysql_connect("localhost","root","PASSWORD");
//Select DB
mysql_select_db("mytvguide");
//Select only results for today and future
$result = mysql_query("SELECT programme, channel, episode, airdate, expiration, setreminder FROM mediumonair where airdate...
I have a web-app that has a master mysql db and four slave dbs. I want to handle all (or almost all) read-only (SELECT) queries from the slaves. Our load-balancer sends the user to one of the slave machines automatically, since they are also running Apache/PHP and serving webpages. I am using an include file to setup the connection to...
I've got to convert a not terribly complicated bespoke project management system from MsAccess Application to PHP/MySQL. I've been programming for donkey's years but embarrassingly know practically nothing about modern methodologies.
So the old 'learning curve' versus 'improved efficiency' conundrum rears its ugly head once again.
Alt...
I am relatively new to php and have a feeling that I am going the long way round when displaying data from mysql.
I have a table a I want to show a few fields from my database.
How would I achieve this without having to echo every bit of the table???
Here is the code:
<?php
$query1 = mysql_send("SELECT firstname, lastname, email...
I have output from a select like this:
04:47:37> select * from attributes left outer join trailer_attributes on attributes.id = trailer_attributes.attribute_id;
+----+--------------+----------+-----------+------------+--------------+-----------------+
| id | name | datatype | list_page | trailer_id | attribute_id | attribute_val...