metrostars
-
Posts
169 -
Joined
-
Last visited
Never
Posts posted by metrostars
-
-
Hi.
I 2 tables like this.
users
id 1 2
firstname Bob Jimmy
lastname Hendrix Marley
...
and
bookings
id 1 2
userid 2 2
date 2008-08-12 2008-08-15
...
What I would like is to select a number of fields from users and also the id from bookings that links bookings.userid to users.id.
So:
1 users.id
Jimmy firstname
Marley lastname
2 bookings.id
There must only be 1 id returned for bookings.id per user.
I've tried a number of strawberry mthods but i can't the right one.
Thanks
-
It's under my username.
-
This is my query currently:
"SELECT distinct(departicao), depart FROM flights WHERE NOT EXISTS(SELECT `bookings`.`id` FROM bookings WHERE `date`='$date' AND `bookings`.`flightid`=`flights`.`id`) AND `$day`='1' GROUP BY departicao"
And say i have these 2 tables.
[pre]
bookings:
id flightid date
0 2 2007-12-30
flights:
id depart departicao Mon Tue Wed Thu Fri Sat Sun deptime
2 Newcastle EGNT 0 0 0 0 0 0 1 00:14:56
4 Los Angeles KLAX 0 0 0 0 0 0 0 15:00:00
6 Los Angeles KLAX 0 0 0 0 0 0 1 11:30:00
[/pre]
However, only Newcastle shows in this case, only Los Angeles should show.
But id i empty the bookings table, both Newcastle and Los Angeles show, as they should.
-
I don't exactly see what you want. That should work fine although it's usually better to put the where first.
-
<select name="birthmonth"> <?php $a = 1; while ($a <= 12) { $b = date("F", mktime(0, 0, 0, $a, 1, 0)); if ($regbirthmonth == $b) { $selected = 'selected'; } else { $selected = ''; } echo "<option value=\"$b\" $selected>$b</option>"; $a++; } ?> </select>
Try that.
Edit: I also recommedn changing $selected = 'selected'; to $selected = 'selected=\"selected\"'; so that it is correct HTML encoding.
-
session_start() at the top of every page that uses sessions, including pages where they are set/destroyed.
-
You could try using
php_value upload_tmp_dir /path/to/file
but there seems to be lots of problems with that,
if it fails you could try http://uk.php.net/manual/en/function.ini-set.php
-
You will need it sooner or later, it's really common sense once you've got the main functions learnt.
-
It's probably a problem with your SQL. Post it and let us look.
-
<? ob_start(); ?> <? require_once('config.php'); $user = $_GET['u']; $pass = $_GET['p']; $serial = $_GET['s']; $q = mysql_query("SELECT * FROM `usr_db` WHERE `users` = '".$user."' AND `password` = '".$pass."' AND `serial` = '".$serial."'"); $number = mysql_num_rows($q); if($number == 0) {echo "0";} else {echo "1";} ?>
-
How long do courses last? Are all weeks the same format or are they alternating? Do you want dates etc stored in a dtabase or would you like them to be starting date & formst to be entered each time?
-
<?php $query = mysql_query("SELECT COUNT(*) FROM venues"); $row = mysql_fetch_assoc($query); echo $row['COUNT(*)'] ?>
I think.
-
That is simple. You can't get it any more simple than that. unless you want to put LIMIT 0, 1 on the end, although it isn't necessary if userid is a primary field anyways.
-
That won't work, you have PHP outside of the <? ?>. You'll have to make it a form with the values with a submit button, that links to a page which then deleted the file.
-
Doubt it can be done with PHP alone, What you will have to do is to use a HTML header
<meta http-equiv="refresh" content="300" />
Then use PHP, the number will have to be stored in a session or txt file. You can use PHP to open the txt, find the current number, add 1 to it, and then write the new number to the file. or use a database.
-
upload a phpinfo() file and see if it is already enabled, it often is as standard.
-
<? $currentdate = strtotime("now"); $mysqldate = strtotime($mysqldate); if($currentdate - $mysqldate <= 259200) { //show code } else { // dont show code } ?>
-
if(strpos("$string", 'id4')) {echo "The line contains id4";} else {echo "The line doesn't contain id4";}
-
I just code all PHP myself and use mysql as the database? Don't know what smarty or MVC framework or anything is.
-
echo $temp[6];
-
$sender = "From: unholyprayer@stormgaming.net";
-
For numbers: rand(0, 15);
where 0 is the lowest and 15 is the highest number.
For random letters i usually do something like:
md5(rand(0, 10000));
OR:
str_shuffle(abcdefghijklmnopqrstuvwxyz); is also a possibility.
-
IN is a MySQL reserved word and should not be used for fieldnames or tablenames. Use something else as the field name.
http://dev.mysql.com/doc/refman/4.1/en/reserved-words.html
In was a value he was trying to insert into the data, not a field name.
-
What version of phP u using?
Members' Status Levels
in PHP Coding Help
Posted
I'm don't have access to a server so I can't test it ATM.
EDIT: Didn't notice the single = instead of comparator.