mikosiko
Members-
Posts
1,327 -
Joined
-
Last visited
-
Days Won
1
Everything posted by mikosiko
-
if, as you said... it's normalized... then are you trying to split tables due to the number of records? or you really are not sure if you data structure is correct (and normalized)?... please clarify
-
I need help with updating a single field in my table
mikosiko replied to Magnus9998's topic in MySQL Help
@Joe92 http://php.net/manual/en/function.mysql-query.php -
same result... only difference that having the function in the DB allow you to use it any time you want without write the same over and over... just a different approach
-
Adding a new column with auto increment to an existing table
mikosiko replied to wright67uk's topic in MySQL Help
http://dev.mysql.com/doc/refman/5.1/en/alter-table.html happy study -
so you don't see nothing wrong with this? INNER JOIN partners ON partners.friend_id = user_actions.user_id AND partners.approved = 1 INNER JOIN partners ON partners.user_id = user_actions user_actions2.user_id AND partners.approved = 1 use aliases for each one.
-
mysql_fetch_array() expects parameter 1 to be resource error =P
mikosiko replied to imod3rn's topic in PHP Coding Help
desc and keys are mysql reserved word and +2 with Kenbnsn recommendation -
one option: - Create your function in the DB (small mods necessary) with CREATE FUNCTION - Update your table with UPDATE <table> SET hrtime = miltostandard(<your time field>); done...
-
Please help, trying to input data into DB driving me crazy.
mikosiko replied to VinceGledhill's topic in PHP Coding Help
in //connect to database mysql_connect ("$host","$username","password")or die ("cannot connect to server"); mysql_select_db ("db_name") or die ("cannot select DB"); you $username password is "password" or the content of the variable $password?... same question for "db_name" -
as I thought.... and as I said... this table design should be checked (unless each address could have 3 lines 120 characters each... which will be extremely long) tbl_location location_id -- TINYINT(2), AUTO_INC, PK name -- VARCHAR (255) address1 -- VARCHAR (120) address2 -- VARCHAR (120) address3 -- VARCHAR (120) postcode -- VARCHAR (9) and related with that.... the answer to your previous question: "on the location table, should i put address1 through address7?" ... NO
-
one polling location has 7 addresses?... or you have 7 polling locations each one with only one address? review this table design: tbl_location location_id -- TINYINT(2), AUTO_INC, PK name -- VARCHAR (255) address1 -- VARCHAR (120) address2 -- VARCHAR (120) address3 -- VARCHAR (120) postcode -- VARCHAR (9)
-
... Oh well.... I'm not going to write the code for you, but here is more food for your thoughts that should help you to implement/solve what you want: http://evolt.org/node/4047/ ... it is old, but it shows some concepts that could help you. good luck.
-
Adding a new column with auto increment to an existing table
mikosiko replied to wright67uk's topic in MySQL Help
.. other already told you that an Auto-Increment field MUST be a number and in addition: - Must be a unique auto-increment in one table and it must be defined as a Key. - BEFORE is no part of the syntaxes of ALTER TABLE - If you want to insert the auto-increment field as the first one ... use FIRST (as in the example below) try this: ALTER TABLE `table-name` ADD COLUMN `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (`id`); -
@Nuv... you got this wrong... (partially wrong by the way). - To display the tree the only function that you need to use is display_tree() ... surprising isn't? * if you want to change the final display layout you must adjust this function to your needs, specifically this part: // display indented node title <br> echo str_repeat('----',count($right)).$row['title']."\n" and by the way... but a better display change the "\n" in that line with a "<br />" - The function rebuild_tree() must be used only when you add/modify/delete elements in your tree... it has nothing to do with the display.. but if you make modifications to your tree obviously you must use it before to call the display_tree(). - You are no creating any "temporary table"... and by now your table looks different to the example in the blog because you executed the rebuild_tree() function when was not needed.
-
Countries list, how do I display all countries in a region together?
mikosiko replied to ryandward's topic in PHP Coding Help
good... glad that both codes contributed to your solution. -
Countries list, how do I display all countries in a region together?
mikosiko replied to ryandward's topic in PHP Coding Help
ryan is using a Jquery accordion, therefore he need every region in a <h3> element and all the details associated with each region (countries) in one <div> element per region. everything wrapped in a <div id="accordion"> -
Countries list, how do I display all countries in a region together?
mikosiko replied to ryandward's topic in PHP Coding Help
@ryan: which code did you use finally? -
Countries list, how do I display all countries in a region together?
mikosiko replied to ryandward's topic in PHP Coding Help
@spiderwell: Seems that you are answering to the wrong post... did you read my answer to you and the code that i posted?... doesn't looks like -
You are mixing php short tag and long tag notation in your code... check which one is the valid in your case... if the first echo is working then replace the <?php for <? and test <? $today = date("F j, Y, g:i a"); echo " $today " ?> </div> <?php
-
Countries list, how do I display all countries in a region together?
mikosiko replied to ryandward's topic in PHP Coding Help
@spiderwell : No offense was intended... just pointing that your suggestion is not efficient because imply multiples access to the DB (no just 2 queries as you said) if the OP has 100 regions your suggestion imply 101 queries to the DB instead of apply a different programing method and solve the OP issue with just 1 query... (1 access to the DB)... like p.e: (abstract... only the relevant part shown) $oldRegion = ''; $deleteimg = "http://www.veryicon.com/icon/png/System/Float/Delete.png"; while ($row=mysql_fetch_assoc($result)) { $region = $row['region']; $country = $row['country']; if ($region != $oldRegion) { echo "<h3><a href=\"#\">$region</a></h3>"; $oldRegion = $region; } echo "<div><p><a href=\"delete.php?region=$region&country=$country\" onclick=\"return confirm('Are you sure you want to delete?')\"><img src=$deleteimg height=\"12\"/></a>$country</div>"; } -
Outch!! adjust as you want $CountQuery = mysql_query(" SELECT SUM(IF(status='REFERRAL_STATUS_COMPLETED',1,0)) AS SCOMP, SUM(IF(status='REFERRAL_STATUS_DECLINED',1,0)) AS SDECL, SUM(IF(status='REFERRAL_STATUS_REFERRED',1,0)) AS SREFE FROM TBL_USER_REFERRALS WHERE referrer_uid = $referrer_uid");
-
check your logic again.... in your code: $row =($result->fetch_all()) or die('No records found'); $numRows =$result->num_rows; If($numRows==0) { echo "<h2>Sorry, no articles were found with '$search' in them.</h2>"; } else { While($row=$result->fetch_assoc()) you first $row =($result->fetch_all()) or die('No records found'); already got the first record... which happens to be the only one, and moved the internal pointer... therefore your while loop is no processing anything... is nothing to process right?
-
did you read or try to adjust/modify the function display_tree($root) that is in the provided link?
-
Countries list, how do I display all countries in a region together?
mikosiko replied to ryandward's topic in PHP Coding Help
@spiderwell : even when your suggestion should work, those are no just 2 queries -
if you echo $numRows what do you get?