mysql_query("DELETE FROM gigs WHERE gigname='".$name."'");
Try:
mysql_query("DELETE FROM gigs WHERE gigname='$name'");
Other than that, output $name
mysql_query("DELETE FROM gigs WHERE gigname='".$name."'");
Try:
mysql_query("DELETE FROM gigs WHERE gigname='$name'");
Other than that, output $name
Okay, did you try the code? It should work!
Okay, let me know how it goes :)!
Are you sure this is the correct method to completing this?
I mean, if there are 1-22 sets, are you going to have an if statement for each set?
Ok.
Can you please tell me what the result of this is:
<?php
$host="mysql6.000webhost.com"; // Host name
$username="removed"; // Mysql username
$password="removed"; // Mysql password
$db_name="removed"; // Database name
$tbl_name="direct"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("Error. MySQL Not Responding.");
$SQL = "SELECT url FROM $tbl_name";
$result = mysql_query($SQL);
if(mysql_affected_rows() == 1) // assuming there is only ONE url inside the table
{
$row = mysql_fetch_row($result);
$url = $row[0];
var_dump($url);
//header("Location: $url");
}else{
echo 'Cannot fetch the URL';
}
?>
It will give either NULL, or a string value.. Please post this!!!
Try this:
<?php
$host="mysql6.000webhost.com"; // Host name
$username="removed"; // Mysql username
$password="removed"; // Mysql password
$db_name="removed"; // Database name
$tbl_name="direct"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("Error. MySQL Not Responding.");
$SQL = "SELECT url FROM $tbl_name";
$result = mysql_query($SQL);
if(mysql_affected_rows() == 1) // assuming there is only ONE url inside the table
{
$row = mysql_fetch_row($result);
$url = $row[0];
header("Location: $url");
}else{
echo 'Cannot fetch the URL';
}
?>
Hey first off, for your own purpose, please don't post your MYSQL Account information on a public forum that anyone can see ;)
Second, can you please just var_dump the $url variable where you're trying to re-direct.. So for example:
db_field
<?php
$host="mysql6.000webhost.com"; // Host name
$username="removed"; // Mysql username
$password="removed"; // Mysql password
$db_name="removed"; // Database name
$tbl_name="direct"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("Error. MySQL Not Responding.");
$SQL = "SELECT * FROM $tbl_name";
$result = mysql_query($SQL);
while ($db_field = mysql_fetch_assoc($result)) {
$url = $db_field['url'];
}
var_dump($url);
//Banned st00f...
//include('/home/a1092592/public_html/ban/banned.php');
//redirect....
// header("location:$url");
?>
Then post the the result.. :)
Hey,
I'm guessing 1 = active, 2 = not active..
<?php
mysql_select_db("my_db", $con);
$result = mysql_query("SELECT * FROM gameChart WHERE secID=='1'");
echo "<dl><dt>Writer's Forge</dt>";
if(mysql_affected_rows() == 1)
{
echo "<dd>Collaborated Poetry</dd>";
}else{
echo "<dd><a href='showcase'>Collaborated Sreenplays</a></dd>";
}
?>
Could try this.. I mean, I'm not too sure why you need to fetch the row, only if you wanted to display the actual row that I would do this.
This might helo you :)
Quick question, what text do you have to decipher?
huuhaa
Right, show me (in your php file) how you're defining $url please. :)
i.e. The actual script!!
It's unclear.
What your suggesting is that $url IS defined as a single variable, but has loads of values.. Almost to say:
$url = "www.google.com, www.yahoo.com";
Which, if this is the case then it's the wrong way to go around things.
I don't get what you mean "echo the variable within HTML" my example did that?
Does it give an error?
use:
or die(mysql_error());
Try this:
#include <iostream.h>
int main()
{
int d;
int i=0,n,j,b[100];
cout<<"\n Press 1 for Decimal to Binary converstion";
cout<<"\n press 2 for Decimal to Octal converstion ";
cout<<"\n press 3 for Decimal to Hexadecimal converstion";
cout<<"\n\nEnter your choice: ";
cin>>d;
switch(d)
{
case 1:
cout<<"\nEnter decimal number: ";
cin>>n;
while (n>0)
{
b[i]=n%2;
n=n/2;
i++;
}
cout<<"\nBinary is: ";
j=i-1;
for (i=j;j>=0;j--)
{
cout<<b[j];
}
break;
case 2:
cout<<"\nEnter decimal number: ";
cin>>n;
while (n>0)
{
b[i]=n%8;
n=n/8;
i++;
}
cout<<"\nOctal is: ";
j=i-1;
for (i=j;j>=0;j--)
{
cout<<b[j];
}
break;
case 3:
cout<<"\nEnter decimal number: ";
cin>>n;
while (n>0)
{
b[i]=n%16;
n=n/16;
i++;
}
cout<<"\nHexadecimal is:";
j=i-1;
for (i=j;j>=0;j--)
{
cout<<b[j];
if(b[j]<10)
{
cout<<b[j];
}
else
{
switch(b[j])
{
case 10:
cout<<"A";
break;
case 11:
cout<<"B";
break;
case 12:
cout<<"C";
break;
case 13:
cout<<"D";
break;
case 14:
cout<<"E";
break;
case 15:
cout<<"F";
break;
}
}
}
}
}
Indent your code, it's really messy!!
You might have to cast the variables, by this, I mean specifically define the variable type. Look at this example:
<?php
$budget_min = (int) 20; // CAST the variable (int)
$budget_max = (int) 10; // CAST
if($budget_min <= 20)
{
echo 'The budget is too small!';
}else{
echo 'The budget is fine!';
}
if($budget_min > $budget_max)
{
echo 'The budget is higher than the max budget';
}
// Output:
// The budget is too small!
// The budget is higher than the max budget
?>
So in terms of your example:
$budget_min = (int) $_POST['budget_min'];
And then you can even be more specific and go:
if(!is_numeric($_POST['budget_min']))
die("Not a number");
Hope this helps, try clearing up what you want/need?
Hey,
Look at this:
<?php
$budget_min = 10;
$budget_max = 10;
if(!isset($budget_min) && strlen($budget_min) < 20)
{
// display the errror
}
// Check if the value entered is numeric
if(!is_numeric($budget_min))
{
// display the error
}
if($budget_min >= $budget_max)
{
}
?>
Hope this helps :)
It would be this, surely?:
<?php
$url = "something"; // In my php files $url contain multiple values
?>
<html>
<td><input type="text" size="50" value="<?php echo $url; ?>"/></td>
</html>
Ohhhhhhhh!! You're talking about arrays! Apologies!
So you'd have a list of values:
<?php
$urls = array('www.google.com', 'www.yahoo.com', 'wwww.website.com');
foreach($urls as $url) {
echo $url;
}
// output
//www.google.com www.yahoo.com wwww.website.com
?>
So in theory, it would be something like this:
<?php
$urls = array('www.google.com', 'www.yahoo.com', 'wwww.website.com');
foreach($urls as $url) {
echo '<td><input type="text" size="50" value="' .$url. '"/></td>';
}
?>
mhmh, just a suggestion.. But I don't code like you:
<?php
$callsign = mysql_real_escape_string($_POST['CallSign']);
$query = "SELECT * FROM users WHERE Callsign='$callsign'";
$result = mysql_query($query);
if(mysql_affected_rows() == 1)
{
$row = mysql_fetch_row($result);
echo $row[0] . "<br>";
}else{
echo "That CallSign has been claimed Already!<br>";
echo "<p><a href='register.php'>Return to Try Again</a><br>";
}
?>
I don't see what the problem is? Maybe it's something to do with your database table, how the field name is or something!
ete..
don't know this example make you clear or not.. sorry bcause dont know how to explain..
(-__-
Hey,
I'm pretty sure DaniWeb store their data inside a database!
I think what you're hinting, or suggesting is that you have data read in from Excel; which if is the case then you would parse the data in using XML and then you can then manipulate the data and then save it after the processing/manipulation. - Is this the case?
ete..
don't know this example make you clear or not.. sorry bcause dont know how to explain..
(-__-
Hey,
I'm pretty sure DaniWeb store their data inside a database!
I think what you're hinting, or suggesting is that you have data read in from Excel; which if is the case then you would parse the data in from XML and then you can then manipulate the data and then save it after the processing/manipulation. - Is this the case?
From what you've said - It should be possible.. I believe, not to sure what it is your trying to do though!
Anything is possible, if you put your mind to it ;)
Confused..
By using var_dump, it just dumps whatever is stored in a particular varialbe and then outputs it to the screen (or whatever)! In order to display the output, you should just use echo/printf?
<form action="abc.php" method="post">
<select name="study_class[]" multiple>
<option value="Class 1">CLASS 1</option>
<option value="Class 2">CLASS 2</option>
<option value="Class 3">CLASS 1</option>
<option value="Class 4">CLASS 2</option>
</select>
</form>
abc.php
<?php
#get data
$study_class=implode(', ', $_POST['study_class']);
//var_dump($study_class);
echo $study_class; // this would output it.
?>
<html>
.
.
<P> Study Classes Chosen are: <?php echo $study_class; ?></P>
.
</html>
I don't know if that's what you mean! Or whether you want to actually store the result of var_dump inside a variable.
Try something like this - http://stackoverflow.com/questions/3131845/jquery-keypress-limiting-my-input-on-textarea
Hello,
Have you tried to use jQuery? It has an amazing library for key events. I haven't come across such a thing in PHP before.
No, it should recognise "Class 1", "Class 2"..
<?php
$study = $_POST['study_class'];
var_dump($study);
?>
Then depending on whichever value is entered, should assign this.
I haven't tested it though, might be wrong!
pencils
Here you go..
<?php
$product_name = "pencils";
$product_price= 7.99;
printf( "Product %s will cost %1.1f dollars.",
$product_name, $product_price );
?>
Remember, %s = string. %f = floating point number..
Hope this solves it :)
<?php
$product_name = "pencils";
$product_price= 7.99;
printf( "Product %f will cost %1.1f dollars.",
$product_name, $product_price );
?>
Can't you just echo it?
<?php
$product_name = (string) "pencils";
$product_price= 7.99;
echo "Product $product_name will cost $product_price";
?>
his headfirst trying to code it but bumped into several hurdles and recently started a thread abo
Hello,
I'm kinda confused.. So, basically, you have three drop down menues that contain information that is stored inside a table, and, depending on which item in the drop down menu they choose, changes the next one and the one after that?
As someone mentioned, this can be done using Ajax and have the data passed through that way.. This is a good solution to this problem as it doesn't require the page to be reloaded for the data to be loaded.
Let me know, I may be able to give you some pointers, if, this is actually what you want to do.
Hello,
I dunno if this is what you mean, but I was thinking something like:
<?php
// connection information
$select_query = "SELECT ent_id, mem_id, from_step, from_pos FROM step1_reentry WHERE status='E'LIMIT 1";
$select_result = mysql_query($select_query);
if(mysql_affected_rows() == 1)
{
while($row = mysql_fetch_array($select_result))
{
// retrun the relivent fields.
// but do it in variables, so like $name = $row['name'];
}
// NOW you can do the UPDATE statement.
}
?>
I dunno if this is what you mean, or if it will help.. :)
Which solution worked?
Please mark this thread and solved and give rep to those who helped :)
oops:
change the if statement to this:
if(isset($_SESSION['username']))
{
// handle
}
If that doesn't work then; just try putting this AFTER session_start() in index.php
var_dump($_SESSION['username']);
And see what the result is. If it's NULL then you know that you're not setting the session right.
I don't know because with some servers, it's how you process the linking; like a site that I was working on a while ago killed the sessions because I didn't handle the linking correctly. Give it a go anyway :)
I don't understand the question, so you are able to login, BUT, in index.php it doesn't do the user part (sesson)?
Try this:
<?php
session_start();
include("connect.php");
//check, if user is loged in or not
if(isset($_SESSION[['username']))
{
//log in(member)
echo
"
YOU ARE LOGED IN
<input type='submit' action = 'logout.php' value='logoff'>
";
}
else
{
//not loged in(not member)
echo
"
YOU ARE NOT LOG IN!
<form name='form' method='post' action='login.php'>
<strong>Member Login </strong><br/>
<p id = 'error'>Print Errors here</p>
Username:<input name='username' type='text' id='username'><br/>
Password: <input name='password' type='password' id='password'><br/>
<input type='submit' value='Login'>
<input type='submit' action='register.php' value='register'>
</form>
";
}
?>
Also, in your login script, try not setting the session as what is being posted in the form. Because it might not be case sensative; for example if I entered phorce then displaying the username (in the future) will display as lower case even though I registered the username in uppcase. Just saying :)
@simplypixie - My bad, I haven't done anyt wordpress in about a year. I refused to learn it!
Hey,
So let's say I have a list of names:
$narray[0]="Alfred";
$narray[1]="Robert";
$narray[2]="Deepak";
$narray[3]="Teresa";
$narray[4]="Joshua";
$narray[5]="Chandni";
$narray[6]="Sadiq";
$narray[7]="Vladimir";
And with this list, I wanted to sort the names AND then print the names by ASC, or DESC then we need to handle what is being passed through the url (Take the value after the question mark):
<?php
$narray[0]="Alfred";
$narray[1]="Robert";
$narray[2]="Deepak";
$narray[3]="Teresa";
$narray[4]="Joshua";
$narray[5]="Chandni";
$narray[6]="Sadiq";
$narray[7]="Vladimir";
if(!isset($_GET['se'])) die('Please enter the type of sort');
$type = $_GET['se'];
//$type = 'ASC';
// Or use a switch statement
if($type=='DESC')
{
rsort($narray);
}else if($type=='ASC')
{
sort($narray);
}
for($i=0; $i<8; $i++)
{
print $narray[$i] . " ";
}
?>
Then whichever of the values you put into the url:
site.com/names.php?se=DESC
Vladimir Teresa Sadiq Robert Joshua Deepak Chandni Alfred
site.com/names.php?se=ASC
Alfred Chandni Deepak Joshua Robert Sadiq Teresa Vladimir
Hope this helps :)
Urgh, haven't done any work with Wordpress in a while (Because it's just quite frankly horrible to work with)
BUT, from looking at your code, you open up an if statement, as well a while loop. Where do you close these? so e.g.
<?php
endif();
endwhile();
?>
I think the code is, but I'm not too sure.. This is why you could be getting the $end
Hey,
Yes, I would say it's safe, well, safer than using something like a cookie (Because a SESSION is server side). You could also store the users IP (or other validation checks) which are then checked everytime the data is then used. This could be one option. Also destroy the session after a certain time / inactivity; it depends on the nature of the site though.
Hope this helps :)
Please post your FORM code e.g.
<form method="post" action="" >
// form code
// form code
</form>
So we can help you more :)
Hey,
Haven't ran it, so might not work.. But try this:
<?php
$errors = '';
$myemail = 'emailaddress@gmail.com';//<-----Put Your email address here.
if(empty($_POST['contact[first_name]']) || (empty($_POST['contact[last_name]']) || empty($_POST['contact[email]']) ||empty($_POST['contact[phone]']) || (empty($_POST['contact[company]']) ||
(empty($_POST['contact[position]']) ||
(empty($_POST['contact[country]']) ||
(empty($_POST['contact[question]'])))))))
{
$errors .= "\n Error: all fields are required";
}
$contact[first_name] = $_POST['contact[first_name]'];
$contact[last_name] = $_POST['contact[last_name]'];
$contact[email] = $_POST['contact[email]'];
$contact[phone] = $_POST['contact[phone]'];
$contact[company] = $_POST['contact[company]'];
$contact[position] = $_POST['contact[position]'];
$contact[country] = $_POST['contact[country]'];
$contact[question] = $_POST['contact[question]'];
if (!preg_match(
"/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i",
$email_address))
{
$errors .= "\n Error: Invalid email address";
}
if( empty($errors))
{
$to = $myemail;
$email_subject = "Contact form submission: $name";
$email_body = "You have received a new message. ".
" Here are the details:
\n First Name: $contact[first_name]
\n Last Name: $contact[last_name]
\n Email: $contact[email]
\n Phone: $contact[phone]
\n Company: $contact[company]
\n Position: $contact[position]
\n Country: $contact[country]
\n Question: $contact[question]";
$headers = "From: $myemail\n";
$headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
//redirect to the 'thank you' page
header('Location: http://www.domain.com/contacts');
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Contact form handler</title>
</head>
<body>
<!-- This page is displayed only if there is some error -->
<?php
echo nl2br($errors);
?>
</body>
</html>
Hey,
This might be wrong, I haven't ran it.. But, if this is all in the same .php file, then surely you've already defined $result above? So when you do this:
$query="select amount_id from payment where admission_no='$admission_no'";
$result=mysql_query($query);
while($row = mysql_fetch_array($result)){ ** **// line 250
$amount_id=$row['amount_id'];
}
Maybe that is what is triggering it.
So basically try this:
$success = mysql_query($final) or die(mysql_error());
echo "<table><tr>";
foreach($_POST['fields'] as $f){
echo "<th>".$f."</th>";
}
echo "</tr>";
while($row = mysql_fetch_assoc($success)){
echo "<tr>";
echo "<td>".$row['FIELD_NAME']."</td>"; // $r['username']; as an example
}
echo "</tr>";
}
echo "</table>";
I don't understand what "i" was doing there, or the foreach statement. Since the while loop will end when it returns false (or the query is ended).
Hope this helps
Hey,
Bold Text Here
Why are you repeating name in all of the fields you are trying to process?
<label class="description" for="element_2">Username </label>
<div>
<input id="element_2" **name="element_2"** class="element text medium" type="text" **name="username"**
maxlength="255" value="Hello World!"/>
Could be your problem. Only have one name, in this case "username" then the PHP will know which texfield to get data from.
hahaha =)!
I hope your problem is resolved now (Remember, if you create more functions - Pass the variables through!)
If you thread is solved, please make it solved by clicking the "Mark this thread as solved" and give rep points if you think someone helped!
Goodluck :)
You're using visual studio 2010 professional :P
Have you tried/heard of Dev-Cpp? It's really good for starting out =)!
Why? Does it work, I don't understand?
I don't get the memory location (I think that's what you mean)!
But:
#include <iostream>
using namespace std;
double array_of_5[5] = {1,2,3,4,5};
double sum(double a , double b );
double a= array_of_5[2];
double b= array_of_5[2];
int main ()
{
cout<<"The sum of two members of the array is: " <<sum(a, b) << endl;
return 0;
}
double sum(double a, double b )
{
return a + b;
}
You need to pass the values a and b for it to complete the calculation.
Hope this helps =)
No problem :) If this thread is solved, please mark it and give reputation points to those who helped!
Does the text completely decrypt now?
I would personally go with the one you've gone for.. I.e:
char[] aLetter ={ 'e', 't', 'a', 'i', 'o', 'n', 's', 'r', 'h', 'u', 'l', 'c', 'd', 'f', 'm', 'y', 'g', 'p', 'w', 'b', 'v', 'x', 'q', 'k', 'j', 'z' };
Do the text analysis on the text file.
I think Thines01 can implement a way of switching the letters =)