331 Posted Topics

Member Avatar for johndohmen1963

> $result1=mysql_query($sql1); change it to: $result1=mysql_query($sql1) or die(mysql_error($sql1)); the query is failing or not matching any rows if($_SERVER["REQUEST_METHOD"] == "POST"){ $myusername1=addslashes($_POST['username']); $mypassword1=addslashes($_POST['password']); $ip = $_SERVER["REMOTE_ADDR"];//should still validate this in case $pass1 = md5($mypassword1);//could use $hash1 = hash('sha256', $salt . $mypassword1);//(more secure) $sql1="SELECT * FROM stamboom_admin WHERE username='$myusername1' and password='$pass1' and …

Member Avatar for johndohmen1963
0
219
Member Avatar for sowh4t

<?php $languages = array('en'=>'blabla 0','fi'=>'blabla 1','et'=>'blabla 2'); $langPicked = false; foreach($languages as $k=>$v){ if($_COOKIE['content'] == $k){ $lang = $k; $langPicked = true; } } if($langPicked === false){ $lang = 'en'; } //$lang == 'en' || 'fi' || 'et' //$languages[$lang] == 'blabla 0' || 'blabla 1' || 'blabla 2' ?>

Member Avatar for Biiim
0
98
Member Avatar for LastMitch

How is that checkout data stored? Sorry in advance if code tags don't work Here is a demo check out: QTY--items - Price - Total 6 apple - $0.89 (each) = $5.34 6 orange - $0.89 (each) = $5.34 6 Kiki - $0.89 (each) = $5.34 8 tomato - $0.89 …

Member Avatar for Biiim
3
1K
Member Avatar for sowh4t

you will need to find the http request javascript uses to pull the post, though i'm wondering if i should help or not

Member Avatar for mschroeder
0
127
Member Avatar for Tko_1

try making a second page called sessiondump.php <?php session_start(); var_dump($_SESSION); ?> and navigate to that on the same server after submitting the form veedeoo posted. you need to make sure session_start() is called at the start on any page you want session vars, then they are available in the $_SESSION …

Member Avatar for Biiim
0
203
Member Avatar for mangel.murti

can't read what the top table is called but something like this: $Q = "SELECT * FROM `toptable`"; $R = mysql_query($Q); if($R !== false){ $ularray = array(); while($row = mysql_fetch_assoc($R)){ $ularray[$row['FKGMainId']][] = $row; } }else{ die('no data: '.mysql_error()); } foreach($ularray as $k=>$v){ echo "{$k}<ul>\r\n"; foreach($v as $li){ echo "<li>{$li['QuestionAnswerText']}</li>\r\n"; } …

Member Avatar for Biiim
0
295
Member Avatar for hamedx

yes http://davidwalsh.name/execute-http-post-php-curl use it to post the vars to the login script(the url in the form action='process.php')

Member Avatar for Biiim
0
83
Member Avatar for anita_86

> <select name='name' class="required form-select" title="Please select customer name" onChange='javascript:form_submit();'> the form should only be submitting when you change the option on the select box, are you supposed to be able to enter data after selecting it? if you are this method won't work, you should just use the submit …

Member Avatar for Biiim
0
360
Member Avatar for decade

as far as i know you have to loop, thats exactly what repeating something is. urtrivedi has done a good example of recursion, its basically long hand of doing what `while($i > 1)` does. If you don't want a loop type it out 100 times

Member Avatar for blocblue
0
1K
Member Avatar for gilgil2

just to add a little - If you want a way of generating many dates without having to type them all out use strtotime: $i = 0; while($i <= 60){ $date_Array[] = date("Y-m-d",strtotime("-$i day")); $i++; } [strtotime()](http://php.net/manual/en/function.strtotime.php)

Member Avatar for gilgil2
0
188
Member Avatar for CriticalError

somepage.php <?php $pagedata = array(); $pagedata['title'] = 'Test'; $pagedata['cssfile'] = 'template1.css'; require_once('template1.php'); ?> template1.php <html> <head> <title><?php echo $pagedata['title'];?></title> <link type='text/css' rel='stylesheet' href='<?php echo $pagedata['cssfile'];?>'> </head> <body> <div style='background-color:#ccc;'></div> </body> </html> Pretty simplistic but it lets you switch between templates rather easy

Member Avatar for veedeoo
0
409
Member Avatar for grako84

3 equals checks that the 2 variables have the same value AND type(strict) 2 equals just checks that the value matches(loose) data coming from post and get vars come in a a string eg. page.php?quantity=1 <?php if($_GET['quantity'] == 1){ echo 'loose match: integar 1<br/>'; } if($_GET['quantity'] === 1){ echo 'strict …

Member Avatar for fobos
0
241
Member Avatar for blaaam

if(ctype_digit($_GET['id'])){ $id = $_GET['id']; }else{ $id = 0; } $query="SELECT * FROM srots where id = {$_GET['id']}"; $result=mysql_query($query); if($result !== false){ $data = mysql_fetch_assoc($result); var_dump($data); }else{ echo 'bad id'; }

Member Avatar for Biiim
0
325
Member Avatar for klemme

I wouldnt create a website in flash unless you do something really fancy, treat flash more like a fancy image or promotion that has a backup or doesn't matter if they can't view it. Generally when you make it the flash has some default thing to show such as the …

Member Avatar for Coloradojaguar
0
231
Member Avatar for don't give up

Heres something to start you off: <?php if(isset($_POST['facebookaccount'])){ $acc = $_POST['facebookaccount']; }else{ $acc = false; } ?> <html> <body> <form action='post'> <table BORDER="0"> <tr> <td>facbook account :</td> <td><input type="text" name="facebookaccount" maxlength="50"/></td> <td><input type="SUBMIT" name="save1" value="save"/></td> </tr> </table> </form> <?php if($acc !== false){ echo "http://www.facebook.com/{$acc}"; } ?> </body> </html> Heres a …

Member Avatar for don't give up
0
113
Member Avatar for rogerg

> $fgmembersite->CheckLogin() whats this object? that needs to have a method to get the currently logged in users user id - then use that to inesrt the user id of the person who uploaded the file eg. $userData = $fgmembersite->getUserData(); function getUserData(){ //$sql = "select * from users where token …

Member Avatar for rogerg
0
507
Member Avatar for |-|x

The way you did it seemed pretty much fastest. I think latest might be getting set too soon, could it be set to only set latest to 1 once it has been sent? I just ended up with this SELECT * FROM tblp p WHERE ver = (SELECT MAX(ver) FROM …

Member Avatar for |-|x
0
155
Member Avatar for breakzzzz20

this is a backtick ` it has a different meaning SELECT `username`, `password`, `fullname`, `course`, `year`, `status` From `account_student` WHERE `id` = '6' they go around database,table and column names only to specifically say it is one, using ' will tell it they are strings

Member Avatar for breakzzzz20
0
236
Member Avatar for kletig

> echo '<script>location.href="index.php";</script>' ; why not just do `header('Location: index.php");` if you are echoing it out? There should be a point in your js where the login succeeds and redirect then: messageDiv.innerHTML = req.responseText; if(req.responseText == 'Success'){window.location = 'index.php';} i always thought it was window.location, since your login is javascript …

Member Avatar for kletig
0
7K
Member Avatar for tahsin.rahit

> if(isset($_SESSION['u_name'])) return $_SESSION['u_name']; > else if(isset($_COOKIE['u_name'])) return $_COOKIE['u_name']; is it possible $_SESSION['u_name'] could be set to ''?

Member Avatar for tahsin.rahit
0
6K
Member Avatar for Wolxhound90

> $success = mysql_query($final) or die(mysql_error()); > echo "<table><tr>"; > foreach($_POST['fields'] as $f){ > echo "<th>".$f."</th>"; > } > echo "</tr>"; > $i=0; > while($row = mysql_fetch_assoc($success)){ > echo "<tr>"; > foreach($row as $r){ > echo "<td>".$r."</td>"; > $i++; > } > echo "</tr>"; > } > echo "</table>"; That …

Member Avatar for Wolxhound90
0
105
Member Avatar for Mko_

mysql_query("UPDATE table SET status = 1 WHERE id = '". $_POST['repid']."'",$c2) or die(mysql_error()); missing the closing double quote! <form method="post"> just change each form's method to post and update the queries like fobos wrote and that should work You may want to add `die(mysql_error($c2));` as if there is one and …

Member Avatar for fobos
0
132
Member Avatar for rotten69

The 2 tables in your example don't sound connected? you need to tell mysql what to join the 2 tables on eg. SELECT username,prod_id,prod_name FROM users LEFT JOIN products on users.uid = products.uid I think mysql will default use the primary keys, if they dont match it can't join so …

Member Avatar for rotten69
0
127
Member Avatar for nexocentric

Looks pretty insane, only thing i can think of: > private function convertToListItem( $heading, $path = "", $isHeading = false, $isSubMenu ) I may not be thinking of php but i thought optional parameters always had to be last in the function declaration and use `var_dump();` to see whats actually …

Member Avatar for nexocentric
0
574
Member Avatar for Wolxhound90

`mysql_fetch_array()` pulls the resource as an associative array and as a numbered array, try changing it to `mysql_fetch_assoc()`

Member Avatar for Wolxhound90
0
114
Member Avatar for charisma
Member Avatar for Buppy
Member Avatar for brammers

speed, ease of use & simplicity are good goals to aim for. Interactive media would make me think flash or a web app. But its a pretty broad area what exactly do you need to code for your exam? jquery and javascript offer alot of interactivity on websites so i …

Member Avatar for Biiim
0
54
Member Avatar for Wolxhound90

> $str &= $_POST['txt'.$i]. $str .= $_POST['txt'.$i]; not sure what &= does You could also just loop through the $_POST array $str = ''; foreach($_POST as $k=>$v){ if(substr($k,0,3) == 'txt'){ $str .= $v; } } echo $str;

Member Avatar for Wolxhound90
0
95
Member Avatar for tubesnube

Hows this work? <?php ///----------------------------- /// Inserting data into database ///----------------------------- include 'connect_db.php'; include 'newheader.php'; function sanitize_data($data) { $data = array_map('trim',$data); $data = array_map('strip_tags',$data); $data = array_map('htmlspecialchars',$data); $data = array_map('mysql_real_escape_string',$data); return $data; } $post = sanitize_data($_POST); if ($_POST['searchID']) { $searchById = "SELECT * FROM tc_tool.forms WHERE doc_id = '$doc_id' LIMIT …

Member Avatar for tubesnube
0
302
Member Avatar for showman13

or SELECT user, pass, email, count(*) as `num_accounts` FROM members WHERE mem_status <>'T' GROUP BY email ORDER BY email asc";

Member Avatar for showman13
0
195
Member Avatar for Red Dragon

$to = "myemail@domain.com"; $subject = "Contact Form Posting"; $additional_headers = "From: ".$_POST['name']." <".$_POST['email']."> \r\n"; //use . to concatenate strings/variables together $message = $_POST['msg']; //no $ in front of mail, it's a function if(mail($to, $subject, $message,$additional_headers)){ echo "We've recived your contact information"; } else { echo "ERROR"; }

Member Avatar for Red Dragon
0
390
Member Avatar for phplover

DELETE FROM users WHERE user_status = 0 AND date_signed_up < DATE_SUB(NOW(), INTERVAL 2 DAY); or UPDATE users SET `deleted` = 1 WHERE user_status = 0 AND date_signed_up < DATE_SUB(NOW(), INTERVAL 2 DAY);

Member Avatar for phplover
0
3K
Member Avatar for saadi06

Ardav is right, mysql won't be able to make proper use of indexes either ALTER TABLE `dates` ADD COLUMN `start_date2` DATE NULL AFTER `start_date`, ADD COLUMN `end_date2` DATE NULL AFTER `end_date`; UPDATE `dates` SET start_date2 = STR_TO_DATE(start_date,'%m/%d/%Y'), end_date2 = STR_TO_DATE(end_date,'%m/%d/%Y'); If its not possible to change it your query would …

Member Avatar for diafol
0
1K
Member Avatar for ZER09

=> is used for arrays, denoting key/value pairs eg. $array = array('item1'=>'apple','item2'=>'pear'); foreach($array as $key=>$value){ echo $key.' = '.$value; } -> is used for object orientated processing (OOP) eg. $shoppingcart = new basket(); $shoppingcart->addItem('apple'); $shoppingcart->displayBasket();

Member Avatar for ZER09
0
102
Member Avatar for nchy13

Just to confirm it should be like this: ($username maybe not set?) page1.php <? session_start(); $_SESSION["username"] = 'Testing'; echo '$_SESSION["username"] set to Testing'."<br/>\r\n"; echo "<a href='page2.php'>page 2</a>"; ?> page2.php <?php session_start(); var_dump($_SESSION["username"]); //phpinfo(); ?> If it's not working uncomment the `phpinfo();` that will tell you a list of the php …

Member Avatar for nchy13
0
197
Member Avatar for ashiiiish

> <a href='viewnotice.php?nid=$nid'>$ntitle</a> That is a GET variable not POST $noticeid=$_GET['nid'];

Member Avatar for rajesh1158
0
125
Member Avatar for robertcraiguk

hey, your select query isn't pulling the id > $db->query(" > SELECT COUNT(id) AS total, > login > FROM users > WHERE login = '$login' > AND password = '$password' > "); $db->query(" SELECT COUNT(id) AS total, id, login FROM users WHERE login = '$login' AND password = '$password' ");

Member Avatar for Biiim
0
218
Member Avatar for Venom Rush

Theres 2 sides, one is the php ini setting: set_time_limit($seconds); That will override that, the other side is your server script timeout such as cgi script timeout on IIS, you have to allow it more time but im not sure how to set that one and completely depends on what …

Member Avatar for pritaeas
0
191
Member Avatar for Tristan2036

im no linux genius but i connect to mysql through putty using the command: mysql -uuser -ppassword no spaces after -u or -p the user is usually root Can you not get onto mysql through phpmyadmin on plesk?

Member Avatar for Tristan2036
0
1K
Member Avatar for RazorRamon

I recently improved a database we had in a similar setup, we had a table for every client which held all the relevant data for the company, this was setup over 2 years ago now and we were up to over 500 tables! the lack of scalability starting to show …

Member Avatar for Biiim
0
1K
Member Avatar for Buppy

Will the iconv() function solve that for you? http://www.php.net/manual/en/function.iconv.php

Member Avatar for diafol
0
101
Member Avatar for dyingatmidnight

why not just put it at the top of index.php? I personally don't like using htaccess www.example.com/index.php <?php if(ISSET($_GET['id']) && ctype_alnum($_GET['id'])){ header("Location: http://www.example.com/{$_GET['id']}"); }

Member Avatar for dyingatmidnight
0
143
Member Avatar for RageAndSin

its probably the file functions? Take out the @ symbols - they suppress errors My php page: <?php echo '<a href="form1.html">sign my guest book</a>'; $guestbook = fopen("sign.txt", "r"); while (!feof($guestbook)) { echo "\n" . fgets($guestbook) . "<br />"; } fclose($guestbook); $datetime=date("y-m-d h:i:s"); $data = "<h1>" . $datetime . " \n" …

Member Avatar for Biiim
0
2K
Member Avatar for bo0ga

I doubt google places has been setup to recieve auto form submission data from external websites, you could get the data from them then fill it in yourself - its not ideal though cause these reviews will all come from the same ip which is a common check on reviews …

Member Avatar for Biiim
0
211
Member Avatar for magicmarkuk

> <?php > if ( is_singular() ) { > global $wp_query; > $postid = $wp_query->post->ID; > $ad468 = get_post_meta($postid, 'ad468_post', true); > if ( !$ad468 && get_option('stream_ad468') == 'yes' ) { > $ad468 = get_option('stream_ad468_code'); > } > } > if ( !is_singular() && get_option('stream_ad468') == 'yes' ) { > …

Member Avatar for Biiim
0
143
Member Avatar for rrahulrroshan

>veedoo, wanna ask you something....can this code be done purely in php(not using javascript) >thanks As far as i know you can't copy what veedeoo has done in his demo above, thats client side scripting - css will be the closest you can get to interactivity on the webpage without …

Member Avatar for gokulllrajjj
0
214
Member Avatar for Mariel Pineda

change $result= mysql_query($query); to: $result= mysql_query($query) or die(mysql_error());

Member Avatar for broj1
0
388
Member Avatar for Mariel Pineda

your edit link is wrong? echo "<td align=center>"."<a href=delete.php?Code=".$row['Code']."><input type='image' src=erase.ico></a>"."</td>"; echo"<td align=center>"."<a href='home_edit.php?Code=$code'> <input type='image' src=edit.png></a>"."</td></tr>"; it says `$code` instead of `$row['Code']`

Member Avatar for fobos
0
160
Member Avatar for sibbs06

thats a php compile error, you have some bracket/quote/semicolon missing somewhere. it will be on or before line 83 probably not too far back

Member Avatar for Biiim
0
146

The End.