
bubblegum.anarchy
-
Posts
526 -
Joined
-
Last visited
Never
Posts posted by bubblegum.anarchy
-
-
Use DISTINCT or GROUP BY to remove the duplicates.
Definitely group by, DISTINCT is the most useless modifier I've ever come across (except inside a COUNT() ).
or GROUP_CONCAT
-
-
Confirm that Oracle uses the same GROUP_CONCAT function as MySQL does.
EDIT: Oracle does not appear have a group_concat function.
-
What is a regged email and what does the array have to do with anything if the query output is fine?
-
What don't work? - you have to submit the information first.
-
I doubt that the client used matters but just incase - ALTER queries performed via SQLyog community v5.31
-
Use DISTINCT or GROUP BY to remove the duplicates.
-
Use the php trim function:
trim($key)
-
change the following line:
GetSQLValueString($_POST['period'], "text"),
to:
mysql_real_escape_string($_POST['period']),
so that no quoting occurs.
-
Change this line:
<?php $tsel = mysql_query("select * from `users` where `userlevel`='0' and `status`='alive' order by `rank` desc limit 10"); while ($top=mysql_fetch_array($tsel)) { // line 36 print "<tr><td></center><a href=profile.php?viewuser=$top[username]>$top[username][/url]</td><td align=right>$top[rank]</td></tr>"; } ?>
To this:
<?php $tsel = mysql_query($query = "select * from `users` where `userlevel`='0' and `status`='alive' order by `rank` desc limit 10") or trigger_error(mysql_error()."<PRE>".$query."</PRE>", E_USER_ERROR);; while ($top=mysql_fetch_array($tsel)) { // line 36 print "<tr><td></center><a href=profile.php?viewuser=$top[username]>$top[username][/url]</td><td align=right>$top[rank]</td></tr>"; } ?>
... and investigate the mysql error.
-
Change this line:
$sql = "UPDATE school_book SET title='$title', category='$category', type='$type', processed='$processed', image='$image', url='$url', description='$description', username='$username', user='$user' WHERE id=$id"; //replace school_book with your table name above $result = mysql_query($sql) or die(mysql_error());
To this:
$sql = "UPDATE school_book SET title='$title', category='$category', type='$type', processed='$processed', image='$image', url='$url', description='$description', username='$username', user='$user' WHERE id=$id"; //replace school_book with your table name above die($sql); $result = mysql_query($sql) or die(mysql_error());
and post the result contained in $sql;
-
heh...
SELECT Max( report_date ) AS LatestDate, loc_id FROM report_index GROUP BY loc_id HAVING max(report_date) < CURRENT_DATE - INTERVAL 1 YEAR LIMIT 0 , 500
-
unquote LatestDate in the WHERE clause:
WHERE LatestDate < CURRENT_DATE - INTERVAL 1 YEAR
-
I suggest renaming the radio element value attribute to MONTH and DAY and then something like this:
adddate(CURRENT_DATE, INTERVAL $_POST['interval'] $_POST['period']);
... and perform the appropriate data integrity checks before querying.
-
Basic table schematic:
repository.id
repository.date
Query:
SELECT * FROM repository ORDER BY repository.date DESC LIMIT 24
-
$Int = addslashes("Pix 'outside' Interface");
-
Post the three table structures, some test data and a detailed description of what you are trying to achieve.
-
Something like this:
SELECT the_friend.id, the_friend.name FROM users AS person INNER JOIN friends AS friend_of_theres ON person.id = friend_of_theres.friendid INNER JOIN users AS the_friend ON friend_of_theres.userid = the_friend.id LEFT JOIN friends AS friend_of_mine ON friend_of_theres.userid = friend_of_mine.friendid AND friend_of_mine.userid = person.id WHERE person.id = $_SESSION['userID'] AND friend_of_mine.userid IS NULL
-
A table with a user id and product id
vote.user_id
vote.product_id
To verify if the user has voted on any product:
SELECT * FROM vote WHERE user_id = $user_id
To get a total of votes for a product:
SELECT count(*) FROM vote WHERE product_id = $product_id OR SELECT product_id, count(*) AS votes FROM vote GROUP BY product_id ORDER BY votes DESC # most votes first
-
Using version #2 and the following query to order the records:
SELECT FIND_IN_SET(PhotoId, PhotoOrder) AS orderby, Photos.* FROM Photos INNER JOIN `Album Categories` ON Photos,AlbumId = `Album Categories`.AlbumId ORDER BY orderby;
-
Predefined variables, depending on how the data is posted... either $_GET['subcat'] or $_POST['subcat'], or regardless of the method used $_REQUEST['subcat'];
Have a read: http://au3.php.net/manual/en/language.variables.predefined.php
-
Place: print $query just after the call to mysql_query() and post the results - this is not a mysql issue if there is nothing unusual about the results.
-
First of all you need to give name to the form and then using the java script get the values of cat and subcat as given below
$cat=document.formname.cat.options[document.formname.cat.selectedIndex].value
$sub=document.formname.sub.options[document.formname.sub.selectedIndex].value
A server side variable can not be assigned a client side javascript value.
-
Did you write that code, imarockstar?
[SOLVED] Need help optimizing join
in MySQL Help
Posted
Are you still having trouble with that first query?