-
Posts
271 -
Joined
-
Last visited
Posts posted by blacknight
-
-
the first end bracket would work where you have defined $balance it will allways set to what the last row output from your whale statement is
$balance + $row['balance']; will add the total balance from all users same goes for $new_balance = $balance + $deposit; if you have it outside the last } wil it add the totals
-
for your members security you should allways md5 there passwords
$query = "INSERT INTO `members` SET (`username`,`password`) VALUES ('".$username."','".md5($password)."')";
that will insert the info. when you set a field to not null you dont need to set a default value because you have to set the value.
-
when using joins you have to define every table i think so..
FROM `partners`
INNER JOIN `users`
would need something like
FROM `partners` AS partners
INNER JOIN `users` AS users
-
open your php.ini file find
extension=php_mysql.dll extension=php_mysqli.dll
make sure they are uncommented no ; infront of them
-
preg_replace('/.+?({.+}).+/','$1',$json); usualy cleans it up to and stops errors...
-
372 has a space "$row['Note'] ['com'][0]" should be "$row['Note']['com'][0]" my bad .... that could be the issue is nto try replacing line 364 with
"GROUP_CONCAT( `opa`.`product_options_values` SEPARATOR ‘|’) as com ".
-
$query = "SELECT `osh`.`comments`, ". "GROUP_CONCAT( DISTINCT CONCAT(`opa`.`product_options_values`)) as com ". "FROM ".TABLE_ORDERS_STATUS_HISTORY." AS osh ". "LEFT JOIN ".TABLE_ORDERS_PRODUCTS_ATTRIBUTES." AS opa ON". " `oap`.`orders_id` = '$row[OrderNumber]' AND `osh`.`orders_id` = '$row[OrderNumber]'". " ORDER BY orders_status_history_id LIMIT 1"; $row['Note'] = $db->getAll($query); echo $row['Note']['comments'] .'|'.$row['Note'] ['com'][0].'|'.$row['Note']['com'][1].'<br>';
that should.. work....
-
try using this format with wamp
$mysql = $wowdb->connect($db_host, $db_user, $db_passwd, $db_name);
$db = mysql_select_db($db_name);
if(!$mysql) die("Can´t connect to MySql!<br>".mysql_error()." ".mysql_errno());
if(!$db) die("Can´t connect to MySql Database!<br>".mysql_error()." ".mysql_errno());
-
JSON or http vars or post data can be sent to any page as longa s you know the values they are looking for ... like me from home i can run localhost/updater/u.php?cleany&opt=y&back=Y and it posts to my site telling to to run the script to clean optanize and packup my database .. the more i think about it post vars are the best way to go..
-
go in to the phpmyadmin fo the db you want to download go to export select al tables and data and check save as file download to your computer
open wamp interface /localhost/myadmin/ import and upload the file it may take severl upload attempts to load the entire file depending on the size of the file.
-
$result = mysql_query( "SELECT ( select `rider`.`total_points` from`rider` WHERE `rider`.`team-name` = `team`.`rider_name` ) AS `rtotal`, `team`.`rider_name`, FROM `teams` AS team LEFT JOIN `rider_stats` AS rider ORDER BY `rtotal` desc)
i think this should do what you want...
sum the points of all riders on a team and asoc it with 1 team .. then you can loop each team...
orderd by `rtotal` desc should give you a full list of all teamd and there total points...
with out testing it this is the best i can do rite now ...
-
$query="select uname, id from user where id = 1";
-
still not quite understanding .. but heres how to make multidementional arrays...
define a var
$title = array();
define a key
$title['index']=array();
value of a key
$title['index']['home'] = 'texthere';
to call
echo $title['index']['home'];// returns texthere to the screen hope this helps...
-
try changing while($rowone = mysql_fetch_array($parent)){ to while($rowone = mysql_fetch_assoc($parent)){ and try agian
-
befor echo $rowone["menu_name"]; put print_r($rowone); that will give you the values you can call from that query..
-
what the error you get? whats happaning?
-
i think i understand
Subjects
id | name|..
1 | bobs | x | x
Pages
subject_id | name |..
if im correct you want to list each catagory with its subcatagories? try this..
while($row = mysql_fetch_array($result)){ echo $row["menu_name"]."<br/>"; $parent = mysql_query("SELECT * FROM `pages` WHERE `subject_id` = '".$row["id"]."' " ,$connection); if(!$parent){ die("connection error : ".mysql_error()); } while($rowone = mysql_fetch_array($parent)){ echo $rowone["menu_name"]; } echo '<br><hr><br>'; }
your parent query is failing because you closed $row['id'] when you closed teh where statement this will loop each subject and then list each page for it under it end with a echo '<br><hr><br> so sep them for the nest then you can do your formatting
try this i could be wrong...
-
im using the same web server for windows you are try full formatting my sql
$q = "SELECT * FROM `pages` WHERE `subject_id` = '".$row['id']."' ";
-
change
$row = mysql_fetch_array($result1, MYSQL_NUM) && $sql2querynum < '5'
to
$row = mysql_fetch_row($result1, MYSQL_NUM) && $sql2querynum < '5'
but your bigger issue is that you havent set $sql2querynum and
$sql2querynum = mysql_numrows($sql2result);
to
$sql2querynum = mysql_num_rows($sql2result);
and try that
-
verry simple fix
any var that has or could have ' in it use this addslashes($varnamehere)
ex:
SELECT DISTINCT author FROM archives WHERE `title` = '$title' AND `year` = '$year' AND `category` = '$category' AND `group` = '$group' " to SELECT DISTINCT author FROM archives WHERE `title` = 'addslashes($title)' AND `year` = '$year' AND `category` = '$category' AND `group` = '$group' "
best bet when adding stuff in to a dabatase allways use addslases() then when displaying use stripslashes() makes life easier i fond
-
$username="root"; $password="mypassword"; $database="mydatabase"; mysql_connect('localhost',$username,$password); mysql_select_db($database) or die( "Unable to select database"); function drop_empty_tables(){ $tables = mysql_query('SHOW TABLES'); while($table = mysql_fetch_array($tables)){ $table = $table[0]; $records = mysql_query("SELECT * FROM $table"); if(mysql_num_rows($records) == 0){ mysql_query("DROP TABLE $table"); echo "DROP TABLE $table;\n"; } } } drop_empty_tables();
any table on the server the user has rights to with 0 row count will be droped
-
$file = "SELECT * FROM table WHERE column='$name'"; $file2 = mysql_query($sqlfile);
should be
$sqlfile = "SELECT * FROM table WHERE column='$name'"; $file2 = mysql_query($sqlfile);
-
echo '<pre>';
print_r($keys);
that what your looking for?
-
have a look at http://dev.mysql.com/doc/refman/5.0/en/create-trigger.html i dont know much about triggers but this is teh offical doc's
while end bracket
in PHP Coding Help
Posted
that is true
$get = mysql_query("SELECT SUM(balance) as total FROM members WHERE username='$user'");
$row = mysql_fetch_row($get);
$row['total'] would rep the ballance total for the user