mikosiko
Members-
Posts
1,327 -
Joined
-
Last visited
-
Days Won
1
Everything posted by mikosiko
-
pid != 0? in the tables descriptions that you posted before is not a pid field post the sentence that you tried
-
modify it to a regular query imply only use GROUP BY if that not solve what you want... post examples of your data and the desired output
-
group_concat(f_name seperator ', ') forums SEPERATOR ? ... http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat Blue beat me
-
Need help on creating a confusing statement page
mikosiko replied to shenagsandnags's topic in MySQL Help
correction... the select should be: SELECT a.ID, a.Title, b.Category, a.URL FROM Movies AS a JOIN Categories b ON a.Category = b.ID ORDER BY b.Category -
that is not what the OP want:
-
Need help on creating a confusing statement page
mikosiko replied to shenagsandnags's topic in MySQL Help
the first thing you must do is fix your Movie Table This: should be: that mean that you must change your table definition and be sure that the field "category" have the same datatype/length that the corresponding in the table Categories and also that you define a FOREIGN KEY on that field. after that a SELECT like this will pull the data from both tables ordered by category SELECT a.ID, a.Title, b.Category, a.URL FROM Movies AS a JOIN Categories b ON a.ID = b.ID ORDER BY b.Category the rest is only write the logic to display the info in the way that you want (lot of examples here in the forum). -
Not able to call out any values from database using PHP codes
mikosiko replied to genzedu777's topic in PHP Coding Help
genzedu... read my signature.... what do you want... the fish or learn how to fishing? .... part of be a programmer (and sometime the most important) is learn how to debug your own code... specially when you are getting help and clues from others... if you are not capable or you don't know how to do it... just say so and ask -
Not able to call out any values from database using PHP codes
mikosiko replied to genzedu777's topic in PHP Coding Help
wow PFM,,, but that is fact no completely helpful... not a solution -
use UNION http://dev.mysql.com/doc/refman/5.1/en/union.html restriction:
-
yup... I saw the PDO part later... see my previous post ^^^ modified
-
DELETED ... just realize that you are using PDO... here is something: http://www.php.net/manual/en/pdostatement.bindparam.php one of the comments there: This works ($val by reference): <?php foreach ($params as $key => &$val) { $sth->bindParam($key, $val); } ?> This will fail ($val by value, because bindParam needs &$variable): <?php foreach ($params as $key => $val) { $sth->bindParam($key, $val); } ?>
-
No really... doesn't make sense... doesn't "smell" good ... what are you trying to do exactly?... maybe the description of your 2 tables and a little explanation of your objectives will help you to get another point of view
-
no tested in my side... but try foreach ($values as $key => $val) { $key = (int) $key + 1; $val = "'" . $val . "'"; .... } or using " instead of '
-
did you "echo" $_fields and $_values what echo shows?
-
this is one way to do it SELECT @rownum:=@rownum+1 AS rownum, a.* FROM <YOUR TABLE> AS a, (SELECT @rownum:=0); but... why you need to do this?
-
Not able to call out any values from database using PHP codes
mikosiko replied to genzedu777's topic in PHP Coding Help
same answer that was given to him here http://www.phpfreaks.com/forums/mysql-help/you-have-an-error-in-your-sql-syntax-321480/msg1514672/#msg1514672 -
answer is here http://www.phpfreaks.com/forums/faqcode-snippet-repository/
-
When you create a table can you have same attribute repeating
mikosiko replied to xxreenaxx1's topic in MySQL Help
try again -
the answer is in my previous answer Ah.. and I forgot to modify your original select which also has the SUM in the wrong position SELECT news_id, news, date, time, user_id, session_id, username, password, email, user_access FROM news INNER JOIN users USING (user_id), SUM(news_id) AS comments FROM news_comments GROUP BY news_id ORDER BY date to be valid should be SELECT news_id, news, date, time, user_id, session_id, username, password, email, user_access, SUM(news_id) AS comments FROM news INNER JOIN users USING (user_id) GROUP BY news_id ORDER BY date add the other join and replace the SUM for a COUNT(news_comments.news_id)
-
just to make you select valid...here SUM(news_id) AS comments FROM news_comments take out FROM news_comments but I don't think you are doing what you apparently want... seems to me that you want to count the records in the table news_comments.. in such case you select is incorrect... you need to join the table news_comments too, replace SUM by COUNT and identify the field upon you are counting on properly (news_id is in both tables, news and news_comments right?)
-
the answer is... depend here is an old article about it but still very much covering the possibles scenarios (read the comments too..one of them in special give more insights to the topic) http://www.mysqlperformanceblog.com/2007/04/10/count-vs-countcol/
-
@isedeasy To get better help - What is the EXPLAIN result for that sentence? - Post Tables structure and Index definitions... complement with number of rows in each table
-
Transaction commits but then SELECT statement fails
mikosiko replied to TheFilmGod's topic in MySQL Help
agree with Fenway and Muddy... post your code to get better help... just guessing.... to execute your Transaction are you using an Stored Procedure or Function?... something like: <?php $query = "CALL your_procedure()"; mysql_query($query); .... .... $query2 = "SELECT a,b,s .... "; mysql_query($query2); // The error could be triggered here depending on what you did // before this query with the results of the previous one ?> if is something like this what are you doing then the error is caused because you are no processing all the results produced by the SP (at least 2). -
you can use: isset() and/or empty() lot of examples around