nav33n 472 Purple hazed! Team Colleague Featured Poster

umm.. Can you post your code ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Wrong forum christico80. Post your question in hardware forum. Welcome to Daniweb btw!

nav33n 472 Purple hazed! Team Colleague Featured Poster

:) Welcome to Daniweb ronicasingh.

nav33n 472 Purple hazed! Team Colleague Featured Poster

I don't know.. Be specific about your question. What do you mean by no luck ? What is the problem ? My suggestion is, split your script into small parts and debug.

nav33n 472 Purple hazed! Team Colleague Featured Poster

You are welcome :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

:) You are welcome!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Yeah.. something like that.. Simple example.

$id = $_POST['id']; //say the user has entered 10 in the form.
$checkarray = array("10","20","30");
if(in_array($id,$checkarray)){
// redirect.. $id found in the array
} else {
//redirect to error page $id not found in the array
}
nav33n 472 Purple hazed! Team Colleague Featured Poster

:) Yep! lol.. Sometimes it happens..

nav33n 472 Purple hazed! Team Colleague Featured Poster

In your above script, you are getting the records to $result. But you aren't printing anywhere. Try printing out $result somewhere.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hi I'm new to PHP and i'm stuck in this code....
i knw how to do it in javascript but not in PHP
i want to grab the value from a text field and check if tht value exist in an array and if it does then redirect to next page else ask the user to enter a valid number
can u help me plzzz?
thx

When the form is submitted, $_POST will have the value of the textbox. Then check if $_POST is in the array using in_array function. http://nl2.php.net/in_array
Then redirect if its in the array.

nav33n 472 Purple hazed! Team Colleague Featured Poster

When you use select query, you need to 'fetch' the rows and display it. You do it this way.

<?php
//connect
//select db
$query = "select * from table where id='$id'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
echo $row['firstname'];
echo $row['lastname'];
//etc..
}

:) Cheers..

nav33n 472 Purple hazed! Team Colleague Featured Poster

You should actually try and avoid using SELECT * and rather list the columns you want to be returned SELECT [I]col1, col2, col3[/I] It just helps speeding things up a bit and you don't have a ton of data flying around the web that you don't need.

Very true. But if you don't know what columns you wanna display and what not, you can use *.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Where are you trying to display the records ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Update query is correct. But select query is wrong.

SELECT * FROM cms_core WHERE id= '1'

You can use this.

nav33n 472 Purple hazed! Team Colleague Featured Poster

And you don't have that syntax error anymore. Right ? Now, if that solves your problem, well and good. If it doesn't, you need to be specific about your problem.

kevin wood commented: he is very helpful all the time +1
nav33n 472 Purple hazed! Team Colleague Featured Poster

You can use is_int
Eg.

if(is_int($letter2)){
$letter3="#";
} else {
 $letter3=$letter2;
}
Scottmandoo commented: Thanks +1
nav33n 472 Purple hazed! Team Colleague Featured Poster

Then obviously, the table has records. What do you want exactly ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Huh! Can you post your complete code ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Sanitizing user input means stripping the posted data from anything that may be malicious

You can use mysql_real_escape_string for the user input or addslashes.

nav33n 472 Purple hazed! Team Colleague Featured Poster

:) You are welcome!

nav33n 472 Purple hazed! Team Colleague Featured Poster

$res will have the resource_id of the query you just executed. You can check if there are any records or not this way.

$res = mysql_query($SQL,$db);
if(mysql_num_rows($res) > 0){
echo "There is something!";
} else {
echo "Nothing !";
}
nav33n 472 Purple hazed! Team Colleague Featured Poster

Syntax error while updating the record or while fetching ?

$SQL = "SELECT cms_core FROM '$sContent' WHERE id=1";

$sql="UPDATE cms_core SET editorial='$sContent' WHERE id=$id";

cms_core ? is it a table or a column name ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

hmm.. Strange.. It didn't throw any error !

nav33n 472 Purple hazed! Team Colleague Featured Poster

No dude. You are checking before creating the directory. Do the same after you create the directory. That way, you will know if it really created the directory or not.

nav33n 472 Purple hazed! Team Colleague Featured Poster

<input type="text" name="txtEmpFName" value="<?php echo $user; ?>" id="txtEmpFName" size="16" width="160" />

nav33n 472 Purple hazed! Team Colleague Featured Poster

hmm.. When you execute mkdir, check again if that directory exists. ie.,

mkdir($uploaddir1,0777);
if(is_dir($uploaddir1))
{
echo "Exists!";
}
else
{
echo "Doesn't exist" ;
}

nav33n 472 Purple hazed! Team Colleague Featured Poster

-894

nav33n 472 Purple hazed! Team Colleague Featured Poster

Can you post your code and explain a lil bit more ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Yep. Its correct. Make sure that none of the variables are empty.

nav33n 472 Purple hazed! Team Colleague Featured Poster
nav33n 472 Purple hazed! Team Colleague Featured Poster

Print out your query, execute it in phpmyadmin/ mysql console and see if it works. You can also give "die" to check if your query is working or not.
ie.,

$query = mysql_query("your query") or die(mysql_error())";
justted commented: Very helpful :O) +1
nav33n 472 Purple hazed! Team Colleague Featured Poster

<input type="text" name="username" value="<?php echo $_POST['username']; ?>">

nav33n 472 Purple hazed! Team Colleague Featured Poster

Thats strange! check if $uname is empty.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Huh! When you say you are storing the path in the table, whats the problem then ? Get the path from the table and put it in img tag. <img src='path_of_the_image'>

nav33n 472 Purple hazed! Team Colleague Featured Poster
$query = "select * from table where username='username_value' and password='password_value'";
$result = mysql_query($query);
$row = mysql_fetch_array($result); // if you query returns only 1 row
//while($row = mysql_fetch_array($result){ if your query returns more than 1 row
$firstname=$row['firstname_column'];
$lastname=$row['lastname_column'];
//and so on..

I hope thats clear ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

-891

nav33n 472 Purple hazed! Team Colleague Featured Poster

Good. Now, in view_details.php, get the id value, query the table and print it !

nav33n 472 Purple hazed! Team Colleague Featured Poster

It will work. Why are you checking if $_POST is empty ? What is stored in $reason ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

-886

nav33n 472 Purple hazed! Team Colleague Featured Poster

As far as I can see, there isn't much of a difference. I noticed a negligible amount of delay few hours ago. (Umm.. maybe because I am used to slow speed internet.)

Secondly, to be able to afford to keep Davey, and other staff writers, on the payroll to deliver blog entries to you every day

They get paid ? Wow..

nav33n 472 Purple hazed! Team Colleague Featured Poster

You can do this. <input type="text" name="firstname" value="<?php echo $_POST['firstname']; >?">

nav33n 472 Purple hazed! Team Colleague Featured Poster

If it was successful in connecting, why would it say access denied ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome Luc!

nav33n 472 Purple hazed! Team Colleague Featured Poster
nav33n 472 Purple hazed! Team Colleague Featured Poster

I guess you have php version 5+ ? Check this out to make php work with apache. http://www.expertsrt.com/tutorials/Matt/install-apache.html or you can try wamp, which is a package of apache, mysql and php.

nav33n 472 Purple hazed! Team Colleague Featured Poster

-884

nav33n 472 Purple hazed! Team Colleague Featured Poster

:) Don't create multiple threads for same question.

nav33n 472 Purple hazed! Team Colleague Featured Poster

When the user logs in, check if its a valid login. If, yes, then query the table which has the user details for this username. Since this is a login script, username has to be unique. So, a username can have only 1 row of details.

<?php 
//connection
//get the form variables values
//check for valid login
if (true) {
$query = "select * from table where username='username_value_'";
//get the details
}

The more simple way is to query the table while checking for valid username.

<?php
//connection
//get the form variables
$query = "select * from table where username='username_value' and password='password_value'";
//if mysql returns more than 0 rows display his details. If its an invalid details, display error message or redirect back to login page.

You can check out w3schools for php-mysql tutorial.

Cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

-882