I've got a site that requires manual creation of the database tables on install. At the moment they are saved (along with any initial data) in a collection of .sql files.
I've tried to auto-create using exec() with CLI MySQL and while it works on a few platforms it's fairly flakey and I don't really like doing it this way, plus it is h...
What's wrong with my code, Im just a beginner. The error said it was an undefined index.
A record is added to mysql but its just 0's. What' s the proper way of doing this
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("Hospital", $con);
$hospnum = ...
Hello,
I have a MySQL table ordered like this :
| user_id | day | time | job |
|--------------------------------|
| 1 | 2455251 | 08 | T23 |
| 1 | 2455252 | 14 | T14 |
| 1 | 2455253 | 22 | T27 |
| 2 | 2455251 | 06 | T16 |
| 2 | 2455252 | 12 | T64 |
| 2 | 2455253 | 20 |...
currently i'm using this XAMPP Lite 1.7.3
+ Apache 2.2.14 (IPV6 enabled)
+ MySQL 5.1.41 (Community Server) with PBXT engine 1.0.09-rc
+ PHP 5.3.1 (PEAR)
+ Miniperl 5.10.1
+ XAMPP Control Version 2.5.8 (ApacheFriends Edition)
+ XAMPP CLI Bundle 1.6
+ XAMPP Port Check 1.5
+ XAMPP Security 1.1
+ SQLite 2.8.17
+ SQLite ...
I need to normalise a table which contains cricket players:
+------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| matchID | int(11) | NO | PRI | 0 | |
| innings | int(11) | N...
I'm wondering what the best way is to prevent my server from being stressed when I want to get a lot of data using PHP.
Convert all my data to an XML sheet? Use caching?
The data comes from many different databases and different tables.
Any ideas?
Thanks in advance
...
$content = '<h3>popular tags »</h3><hr>';
$result = $db->sql_query("SELECT tags FROM ".DOWNLOAD_TABLE." ");
while($row = $db->sql_fetchrow($result)){
$dl_tags_id = $row['tags'];
$dl_tags_id_ex = explode(" ",$dl_tags_id) ;
$dl_tags_id = array_unique($dl_tags_id_ex);
$c = count($dl_tags_id);
for($i=1...
I have a following MySQL with two parameters, $catname and $limit=1.
And it is working fine.
SELECT P.*, C.Name AS CatName
FROM omc_product AS P
LEFT JOIN omc_category AS C
ON C.id = P.category_id
WHERE C.Name = '$catname'
AND p.status = 'act...
Hello. So i have this videosection, but i want to make a "sorting" option avaible for users.
Sorting Options: ALL (no WHERE in the sql statement), Videoklips (WHERE SCtry = 0), SC try (WHERE SCtry = 1)
Now, i know how to do it "my" way. I would have placed links on index.php:
?sort=video and ?sort=SCtry
Then make 2, if sort video, if ...
I have a classifieds website...
I have Solr doing the searching of the classifieds, and then return ID:nrs which I then use to put into an array. Then I use this array to find any classifieds in a MySql db where the ID:s match the ID:s in the array returned by Solr.
Now, because this array can be very very big (100thousand records or mo...
i am writing two list application where data from one list can be shifted to other list.
i am using DIV like this
<div id="all_users">
<div id="user1" userid="1" class="innertxt"> <img src="images/images.jpg" width="50" height="50"><strong>Test User 01</strong>
<ul>
<li>User ID: 1</li>
<li>Email: u...
When I select a set of rows from a table using IN, e.g.
SELECT x.y, x.z FROM x WHERE x.id IN (23, 55, 44, 12)
is there an SQL trick to get them back in the order given in the IN set?
So in the example, assuming x has rows with ids 23, 55, 44 and 12, those four rows would be returned in that order.
...
I'm looking for a tutorial explaining how to work with these 3 technologies, found this one, but it's working with HyperSql DB (yeah, I edited hibernate.cfg.xml to connect with MySql... but I just received a bunch of errors).
...
Hi,
I'm now trying to populate my 'testMatch' table (below) with data from my unormalised 'summary' table:
TESTMATCH TABLE
+------------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------------+--------------+------+-----+---------+-------+
| match_id ...
I currently have a user's table which contains a one-to-one relationship for Youtube OAuth tokens. However, I now want to support multiple video sites and want to break this into a one-to-many relationship.
I have setup the new tables:
tokens - cols: id, site, username (the user's username on Youtube), oauth_token, oauth_secret
...
Where is the most secure place to put MySQL database connection details when connecting via a PHP script?
$connection = mysql_connect($hostname, $username, $password);
if (!$connection) {die('Could not connect: ' . mysql_error());}
mysql_select_db($database, $connection);
I know it's not a good idea to put them directly in the script ...
I asked a similar question before only to later discover that what I thought was the answer didn't work because I hadn't asked the right question (and hadn't noticed that the answerer told me this). To revisit, I have a table of comparisons. I'm trying to select the row with the maximum version for each set of two students. So what I had...
How can you write the following in MYSQL?
SELECT AVG(col1) FROM table WHERE DISTINCT col2
more info:
table
col1 | col2
-----------
2 | 555.555.555.555
5 | 555.555.555.555
4 | 444.444.444.444
returns '3'
Basically I'm trying to select average value of col1 where ip addresses in col2 are distinct.
...
im trying to insert this query with mysql_query
INSERT INTO um_group_rights (`um_group_id`,`cms_usecase_id`,`um_right_id`) VALUES (2,1,1) ;
INSERT INTO um_group_rights (`um_group_id`,`cms_usecase_id`,`um_right_id`) VALUES (2,2,1) ;
INSERT INTO um_group_rights (`um_group_id`,`cms_usecase_id`,`um_right_id`) VALUES (2,3,1) ;
INSERT INTO...
i have a table of songs and their beats-per-minute values, and i would like to build playlists that follow a curve like this:
^ . . .
| . .
b | . .
p | . .
m | . .
x-------------------->
time
i realize this is probably not possible in a single SQL statement, but i'm in...