jazzman1
Staff Alumni-
Posts
2,713 -
Joined
-
Last visited
-
Days Won
12
Everything posted by jazzman1
-
Assuming that you have 8 users and their id's are form 1 - 8. In this case, you can use SQL IN operator and php implode function. $display_user = array( 1 => 'jazzman', 2 => 'Drummin', 3 => 'mbb87', 4 => 'CristianF', 5 => 'jazzman1', 6 => 'Barand', 7 => 'NoBBy', 8 => 'Ujj' ); $ids = implode(', ', array_keys($display_user)); $sql = "select user_item,track_item,g_id from tracked_item as t left join item_detail on t.user_id=itemID where t.user_id IN ($ids) order by itemSold desc limit 1 ";
-
Why the posters skipped your answers ? I don't really understand this, in case they spoke and read English just fine
-
No, no, NEVER EVER run queries in loops. Take a look at here -> http://forums.phpfreaks.com/index.php?topic=363573.0
-
@sgt_fireman, you have to consider your decisions working with files and uploading them to the server and database. @BuildMyWeb, strrchr is a pretty tricky function (I've never used it), but.... what about this ? It's a real file extension ? $str = 'file_test. php'; $file_ext = substr( strrchr($str, '.') ,true); var_dump($file_ext);
-
Mysql num_rows shows 3 results, fetch array outputs only 2.
jazzman1 replied to Ivan Ivković's topic in PHP Coding Help
I know, that people coming from Balkan Peninsula, they can not say all the true -
One more from me. http://php.net/manual/en/function.next.php $transport = array('foot','foot','bike', 'car', 'plane','bike','bike','bike','car','foot'); $i = 0; while($i < count($transport)){ if($transport[$i] == next($transport)) unset ($transport[$i]); $i++; } echo '<pre>'.print_r($transport, true).'</pre>'; PS. I think, Brand's solution runs faster than mine, but....any way
-
As Pika said, it works just fine. Simple example: $input = 'Hello world 2012'; function containsInteger($input) { return (boolean)preg_match("/[0-9]/", $input); } var_dump(containsInteger($input));
-
I think, it is good idea to post out more of your code. This one works for me: $arr = array( 'name'=>'jazzman', 'time'=>'2PM', 'phone' => '654-234-1129', 'spacial1'=>'?', 'spacial2' =>'\?' ); ?> //jquery get method <script type="text/javascript"> $(document).ready(function(){ $.get('code.php',<?php echo json_encode($arr);?>,function(data){ console.log(data); }) }) </script> code.php echo '<pre>'.print_r($_GET, true).'</pre>';
-
Having an issue with UPDATING SQL Database via PHP Table
jazzman1 replied to mbb87's topic in PHP Coding Help
@ mbb87.... CONGRATULATIONS......THOSE GUYS ARE REALLY AMAZING!!! It's a my solution, I found it few months ago and works perfect ( I can not remember the url of the site). You can use CASE operator. // An array containing the category ids as keys and the new positions as values $display_order = array( 1 => 4, 2 => 1, 3 => 2, 4 => 3, 5 => 9, 6 => 5, 7 => 8, 8 => 9 ); $ids = implode(',', array_keys($display_order)); $sql = "UPDATE `tbl_name` SET `id` = CASE id "; foreach ($display_order as $id => $ordinal) { $sql .= sprintf("WHEN %d THEN %d ", $id, $ordinal); } $sql .= "END WHERE `id` IN ($ids)"; $result = mysql_query($sql) or die(mysql_error()); -
Mysql num_rows shows 3 results, fetch array outputs only 2.
jazzman1 replied to Ivan Ivković's topic in PHP Coding Help
What a query you are copied/pasted in phpMyAdmin? -
Mysql num_rows shows 3 results, fetch array outputs only 2.
jazzman1 replied to Ivan Ivković's topic in PHP Coding Help
Sorry, I meant inside in the beginning in the while loop . while($fetch = $pics -> fetch_array()){ echo '<pre>'.var_dump($fetch).'</pre>'; exit; $description = $fetch['description'] == '' ? 'No Description' : $fetch['description']; ?> <div class="element item"> etc...... -
Having an issue with UPDATING SQL Database via PHP Table
jazzman1 replied to mbb87's topic in PHP Coding Help
Okay, but why did you want to update their columns on the same time -
Mysql num_rows shows 3 results, fetch array outputs only 2.
jazzman1 replied to Ivan Ivković's topic in PHP Coding Help
As Christian mentioned use var_dump function. Put in this piece of code immediately after while loop and post out the result. Put curly brackets in your if statements, too .... echo '<pre>'.var_dump($fetch).'</pre>'; exit; -
Having an issue with UPDATING SQL Database via PHP Table
jazzman1 replied to mbb87's topic in PHP Coding Help
Why do you want to loop the query 26 times -
Mysql num_rows shows 3 results, fetch array outputs only 2.
jazzman1 replied to Ivan Ivković's topic in PHP Coding Help
Hm...... that's truth, there is no generated html code coming from php/mysql script -
Mysql num_rows shows 3 results, fetch array outputs only 2.
jazzman1 replied to Ivan Ivković's topic in PHP Coding Help
Can you reach the thumbnail through the URL in your browser, something like this -> /thumb.php?pic=content/pics/26/13441793754507.jpg -
HTML Form not inserting to mysql... no errors reported
jazzman1 replied to Doc20's topic in PHP Coding Help
Never mind Jesi, zero or 'o'.... I've never seen before this kind of syntax, that's why I was a little confused. I've used 4 databases with different versions and all of them look like this: http://canada.lesno.net/code.php -
php display css with order, 1/2/1/2/1/2/1/2 etc...
jazzman1 replied to anthelo's topic in PHP Coding Help
You want to be something like this? $k = 0; while($k < 10) { for ($i=1; $i < 3; $i++) printf ("%d\n", $i); if($i%2 == 0) $i = 1; $k++; } -
mysql_result() expects parameter 1 to be resource
jazzman1 replied to whopunk123's topic in PHP Coding Help
@off you guys are the best. The best forum that I've ever seen! I'm glad to be a part of you -
HTML Form not inserting to mysql... no errors reported
jazzman1 replied to Doc20's topic in PHP Coding Help
mysql_fetch_array. -
HTML Form not inserting to mysql... no errors reported
jazzman1 replied to Doc20's topic in PHP Coding Help
I thought that one is a multiple array, but obviously not. When I checked his code in my database, I got it nothing of this.. o=> u_id o=> id o=> site_id -
HTML Form not inserting to mysql... no errors reported
jazzman1 replied to Doc20's topic in PHP Coding Help
@ PFMaBiSmAd, how do you explain this output. I was a little confused from that -> http://forums.phpfreaks.com/index.php?topic=363469.msg1720664#msg1720664 Thank you jazzman -
HTML Form not inserting to mysql... no errors reported
jazzman1 replied to Doc20's topic in PHP Coding Help
There is nothing wrong, I just created few minutes ago the same table and that's correct result: Array ( [0] => u_id [Field] => u_id [1] => int(11) [Type] => int(11) [2] => NO [Null] => NO [3] => PRI [Key] => PRI [4] => [Default] => [5] => auto_increment [Extra] => auto_increment ) Array ( [0] => id [Field] => id [1] => int(11) [Type] => int(11) [2] => NO [Null] => NO [3] => [Key] => [4] => [Default] => [5] => [Extra] => ) Array ( [0] => site_id [Field] => site_id [1] => int(11) [Type] => int(11) [2] => NO [Null] => NO [3] => [Key] => [4] => [Default] => [5] => [Extra] => ) Array ( [0] => timestamp [Field] => timestamp [1] => int(55) [Type] => int(55) [2] => NO [Null] => NO [3] => [Key] => [4] => [Default] => [5] => [Extra] => ) Array ( [0] => ip [Field] => ip [1] => varchar(100) [Type] => varchar(100) [2] => NO [Null] => NO [3] => [Key] => [4] => [Default] => [5] => [Extra] => ) Array ( [0] => name [Field] => name [1] => varchar(250) [Type] => varchar(250) [2] => NO [Null] => NO [3] => [Key] => [4] => [Default] => [5] => [Extra] => ) Array ( [0] => username [Field] => username [1] => varchar(250) [Type] => varchar(250) [2] => NO [Null] => NO [3] => [Key] => [4] => [Default] => [5] => [Extra] => ) Array ( [0] => steam [Field] => steam [1] => varchar(250) [Type] => varchar(250) [2] => NO [Null] => NO [3] => [Key] => [4] => [Default] => [5] => [Extra] => ) Array ( [0] => xfire [Field] => xfire [1] => varchar(250) [Type] => varchar(250) [2] => NO [Null] => NO [3] => [Key] => [4] => [Default] => [5] => [Extra] => ) Array ( [0] => email [Field] => email [1] => varchar(250) [Type] => varchar(250) [2] => NO [Null] => NO [3] => [Key] => [4] => [Default] => [5] => [Extra] => ) Array ( [0] => games [Field] => games [1] => varchar(1000) [Type] => varchar(1000) [2] => NO [Null] => NO [3] => [Key] => [4] => [Default] => [5] => [Extra] => ) Array ( [0] => why_join [Field] => why_join [1] => longtext [Type] => longtext [2] => NO [Null] => NO [3] => [Key] => [4] => [Default] => [5] => [Extra] => ) Array ( [0] => clan_history [Field] => clan_history [1] => longtext [Type] => longtext [2] => NO [Null] => NO [3] => [Key] => [4] => [Default] => [5] => [Extra] => ) Array ( [0] => recruit [Field] => recruit [1] => varchar(300) [Type] => varchar(300) [2] => NO [Null] => NO [3] => [Key] => [4] => [Default] => [5] => [Extra] => ) Array ( [0] => age [Field] => age [1] => int(3) [Type] => int(3) [2] => NO [Null] => NO [3] => [Key] => [4] => [Default] => [5] => [Extra] => ) Array ( [0] => location [Field] => location [1] => varchar(250) [Type] => varchar(250) [2] => NO [Null] => NO [3] => [Key] => [4] => [Default] => [5] => [Extra] => ) Array ( [0] => microphone [Field] => microphone [1] => int(11) [Type] => int(11) [2] => NO [Null] => NO [3] => [Key] => [4] => [Default] => [5] => [Extra] => ) Array ( [0] => recruit_style [Field] => recruit_style [1] => int(11) [Type] => int(11) [2] => NO [Null] => NO [3] => [Key] => [4] => [Default] => [5] => [Extra] => ) Array ( [0] => app_status [Field] => app_status [1] => int(11) [Type] => int(11) [2] => NO [Null] => NO [3] => [Key] => [4] => [Default] => [5] => [Extra] => ) Array ( [0] => division [Field] => division [1] => varchar(150) [Type] => varchar(150) [2] => NO [Null] => NO [3] => [Key] => [4] => [Default] => [5] => [Extra] => ) Array ( [0] => notes [Field] => notes [1] => longtext [Type] => longtext [2] => NO [Null] => NO [3] => [Key] => [4] => [Default] => [5] => [Extra] => ) -
HTML Form not inserting to mysql... no errors reported
jazzman1 replied to Doc20's topic in PHP Coding Help
Okay, go to phpmyadmin again and export the table. Post out only the line(s) that begin with, Example CREATE TABLE IF NOT EXISTS `tbl_name` ( `id` int(11) NOT NULL, `name` varchar(244) NOT NULL, `email` varchar(14) NOT NULL, `date` date NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -
HTML Form not inserting to mysql... no errors reported
jazzman1 replied to Doc20's topic in PHP Coding Help
How did you create this table, manually through phpmyadmin or with script got from somewhere ?