Hey guys, I created a list for fixtures.
$result = mysql_query("SELECT date FROM ".TBL_FIXTURES." WHERE compname = '$comp_name' GROUP BY date");
$i = 1;
$d = "Start";
while ($row = mysql_fetch_assoc($result))
{
$odate = $row['date'];
$date=date("F j Y", $row['date']);
echo "<p>Fixture $i - $d to $date</p>";
}
As you can see from the query, the date is displayed from the fixtures table.
The way my system works is that when a fixture is "played", it is removed from this table. Therefore when the entire round of fixtures are complete, there wont be any dates for that round in this table. They will be in another table.
Is there anyway I can run an other query for dates at the same time, and display only dates from the fixtures table if there isnt a date in the results table?
"SELECT * FROM ".TBL_CONF_RESULTS."
WHERE compid = '$_GET[id]' && type2 = '2' ORDER BY date"
That would be the second query!
I am making some updates to a php site which I did not design. I have a local copy of the site. At the top of each page there are settings for the host name for the db connection.
Is there someway I can setup a pointer to the remote address. The address is 'mysqlhost' for example and I want that to point to 'mysql.myhost.com'. I tried creating a HOST record for mysqlhost pointing to the IP address it resolves to but that doesn't work.
If I put 'mysql.myhost.com' in the connection it works. If I put that IP address it doesn't so that is probably why the HOST record idea doesn't work.
Other than creating a local copy of the DB is there a quick way so that I don't have to modify each file in my dev environment and then again when I redeploy?
i'm trying to insert user details, who authorize the app, into the database, but nothing seems to be happening. the data is null and no record is being inserted. is there something wrong with the code?
function insertUser($user_id,$sk,$conn)
{
//$info = $facebook->api_client->users_getInfo($user_id, 'first_name, last_name', 'name', 'sex');
$info = $facebook->api_client->fql_query("SELECT uid, first_name, last_name, name, sex FROM user WHERE uid = $user_id");
for ($i=0; $i < count($info); $i++) {
$record = $info[$i];
$first_name=$record['first_name'];
$last_name=$record['last_name'];
$full_name=$record['name'];
$gender=$record['sex'];
}
$data= mysql_query("select uid from users where uid='{$user_id}'",$conn);
if(mysql_num_rows($data)==0)
{
$sql = "INSERT INTO users (uid,sessionkey, active, fname, lname, full_name, gender) VALUES('{$user_id}','{$sk}','1', '{$first_name}', '{$last_name}', '{$full_name}', '{$gender}')";
mysql_query($sql,$conn);
return true;
}
return false;
}
hi
my users upload photo and all uploads recorded in mysql with the date info. i want to limit uploads by the months. user may just upload 3 pics in a month. what is the best way to do this ?
cheers
Hi, when trying to create a simple procedure in mysql 5.1.47-community it fails everytime i've tried everything!
even simple things like this!
DELIMITER //
CREATE PROCEDURE two ()
begin
SELECT 1+1;
end;
//
I have this table...
--------------------------------------
| user_id | status | status_date |
--------------------------------------
| 1 | Current | 2012-08-01 |
| 1 | Referral | 2012-03-14 |
| 2 | Referral | 2012-04-23 |
| | | |
--------------------------------------
How would I query to find a distinct user_id who has a referral date before 2012-06-30 AND either a current date of after 2012-06-30 or no current status record at all?
Database is MySQL.
excuse my English I speak Spanish
I'm trying to display multiple php and mysql registration, after that the show in an iframe
the problem is that apparently in the iframe shows me errors accents and other characters for example: for example (?D?nde cuesta menos y se consume m?s?")
this is what shows (?)
In the original query or first does not show me that, but in the iframe shows me that error
and probe with http-equiv = "content-type" and I worked
What else I can do?
What should I do?
regards
HI
friends, i wish to store image and resume of user in the data base.
i am using mysql data base and php5. i want to know that which field i set means data type.and how i set the range (maximum size) for uploaded data.
I'm running a LAMP stack. When I go into phpmyadmin, I can see that there are quite a number of sleeping connections which probably should be closed. Is there a way, using either Apache or MySQL, to determine on which pages those connections are created?
<?
include.....
if ($picid != $_GET['picid']) || (empty($picid)) { echo "page not working";
}
else {
$picid = $_GET['picid'];
$query = mysql_query("SELECT * FROM pic_info WHERE picid = 'picid1' ");// problem
while($rows = mysql_fetch_assoc($query)):
$picid = $rows['picid'];
$title = $rows['title'];
$link = $rows['link'];
$description = $rows['description'];
$movie_pic = $rows['movie_pic'];
$source = $rows['source'];
}
$get_comment = mysql_query("SELECT * FROM comment WHERE picid ='$picid'");// work partially
$comment_count = mysql_num_rows($get_comment);
if ($comment_count>0)
{ messages = " ";
while ($com = mysql_fetch_array($get_comment)){
$comment_id = $com['comment_id'];
$name = $com['name'];
$message = $com['message'];
$time_post= $com['time_post'];
$messages .= '<em> on ' .$time_post.'</em><b> '.$name.' said.....</b><br/> '.$message.'<hr/>'; // line with problem
}
}
?>
i am stuck i am trying to say that if $_GET['picid']; is empty echo out error message or if the movid does not exist in the db echo out error message. when i run it i get an error. not sure if i am calling the correct function. what am i doing wrong please help
I've recently been given a MS Access .mdb database file and asked to make it usable in a Linux system. What I'm looking for is a way to convert the Access database to an open-source database such as MySQL or PostGres.
I don't have MS Office, and it's a one-time project for a volunteer organization so I don't want to spend money if it's avoidable. I'm running Vista x64, and have a Linux virtualbox, so something usable in either one will be good.
I looked in about 18 other posts on here an most people are asking how to delete the records not just hide them. So my problem: I have a database with staff members who are associated with locations. Many of the staff members are associated with more than one location. What I want to do is to only display the first location listed in the mysql result and skip over the others. I have the sql query linking the tables together and it works aside from it showing the same information for those staff members that are in those other locations multiple times so example would be like this:
This is the sql statement I have currently
SELECT staff_tbl.staffID, staff_tbl.firstName, staff_tbl.middleInitial, staff_tbl.lastName,
location_tbl.locationID, location_tbl.staffID,
officelocations_tbl.locationID, officelocations_tbl.officeName, staff_title_tbl.title_ID,
staff_title_tbl.staff_ID, titles_tbl.titleID, titles_tbl.titleName
FROM staff_tbl
INNER JOIN location_tbl ON location_tbl.staffID = staff_tbl.staffID
INNER JOIN officelocations_tbl ON location_tbl.locationID = officelocations_tbl.locationID
INNER JOIN staff_title_tbl ON staff_title_tbl.staff_ID = staff_tbl.staffID
INNER JOIN titles_tbl ON staff_title_tbl.title_ID = titles_tbl.titleID
and my php is
<?php do { ?>
<tr>
<td><?php echo $row_rs_Staff_Info['firstName']; ?> <?php echo $row_rs_Staff_Info['lastName']; ?></td>
<td><?php echo $row_rs_Staff_Info['titleName']; ?> </td>
<td><?php echo $row_rs_Staff_Info['officeName']; ?> </td>
</tr>
<?php } while ($row_mysqlResult = mysql_fetch_assoc($rs_mysqlResult)); ?>
What I would like to know is there a way using php to select only the first entry listed for each person and display that and just skip over the other two. I was thinking it could be done by possibly adding the staffID's to an array and if they are in there to skip over the next one listed in the staff_title_tbl but wasn't quite sure how to write it that way. Any help would be great thank you in advance.
Hi Experts,
I am having an issue with importing a large(60MB) CSV file in MYSQLDB.
The problem arises when an address field has multiple comma seperated values e.g. home no, street no, town etc.
I tried to use BigDump for it but, the problem did not solved because of a single field containing multiple comma separated values.
Any idea, suggestion or solution from experts how to handle it?
Please reply, because I am sick of it.
Thanks
I'm creating a page that's a search result...
When you're viewing one of the results, at the bottom of the page, I need to insert "Next result" and "Previous result" links, like a pagination... But from [I think] a saved search, right?
How you people would do this?
Obs.: I'll use CakePHP (PHP) and MySQL
UPDATE files
SET filepath = REPLACE(filepath, `sites/somedomain.com/files/`, `sites/someotherdomain.com/files/`);
I have a table called files with a field called filepath. MySQL returns this error: Unknown column 'sites/somedomain.com/files/' in 'field list'
I have a database in data center, which is running MySQL, and I want to change the database from data center to host in my company. At that time, I don't want to stop the data base in the data center, is there anyway to this kind of integeration? Thank you...
What is the upper limit of records for MySQL database table. I'm wondering about autoincrement field. What would happen if I add milions of records? How to handle this kind of situations?
Thx!
When i dump a table with uppercase letters using mysqldump it comes out as lower case in my dump.sql file. I found a report here in 2006, almost 4 years old http://bugs.mysql.com/bug.php?id=19967
A solution here suggest making linux insensitive. I rather not if possible. Whats the easiest way to copy a win32 db into linux?
I don't know the best way to title this question but am trying to accomplish the following goal:
When a client logs into their profile, they are presented with a link to download data from an existing database in CSV format. The process works, however, I would like for this data to be 'fresh' each time they click the link so my plan was - once a user has clicked the link and downloaded the CSV file, the database table would 'erase' all of its data and start fresh (be empty) until the next set of data populated it.
My EXISTING CSV creation code:
<?php
$host = 'localhost';
$user = 'username';
$pass = 'password';
$db = 'database';
$table = 'tablename';
$file = 'export';
$link = mysql_connect($host, $user, $pass) or die("Can not connect." . mysql_error());
mysql_select_db($db) or die("Can not connect.");
$result = mysql_query("SHOW COLUMNS FROM ".$table."");
$i = 0;
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
$csv_output .= $row['Field'].", ";
$i++;
}
}
$csv_output .= "\n";
$values = mysql_query("SELECT * FROM ".$table."");
while ($rowr = mysql_fetch_row($values)) {
for ($j=0;$j<$i;$j++) {
$csv_output .= '"'.$rowr[$j].'",';
}
$csv_output .= "\n";
}
$filename = $file."_".date("Y-m-d",time());
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: csv" . date("Y-m-d") . ".csv");
header( "Content-disposition: filename=".$filename.".csv");
print $csv_output;
exit;
?>
any ideas?
Basic question, sorry. Basically, I have a script that creates a MySQL entry each time someone visits the page. A logging script. However, I want to make it autoprune after, say, 100 visits.
For example in pseudo code:
if amount of rows > 100 {
delete rows 1+ until amount of rows == 100 }
So in a nutshell, each time a new row is added after 100, it needs to automatically remove the row with the smallest id (My primary key).
Hi
In my mode I am selecting a field as
$query1 = $this->db->query("SELECT dPassword
FROM tbl_login
WHERE dEmailID='[email protected]'");
How to return dpassword as a variable to my controller
I tried this way return dpassword;
I have a 'price' variable that contains some integer number from a MySQL database.
I want to check how many numbers the 'price' variable contains, and add a space in the variable depending on how many numbers. See below:
Example:
If 'price' is 150000 I would like the output to be 150 000 (notice the space).
OR, if it is 19000 I would like it to output 19 000...
How would you do this the easiest way?