/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] parse error and i cant figure out why

hey guys,
i would just like to start off by thanking you guys for taking the time to help others out..im hoping that as i learn more that i to will be help to my pears!!

now to the problem lol

i working a project that will alow bands to post profiles and music and for the most part things have gone really well, im to the get things tight and secrue part and thats were my problems seem to start

[code=php]
64 mysql_query(“SELECT bandname FROM bands Where name=’$bandname'”)
65 $result = mysql_num_rows($query)
66 if($result >=1) {
67 echo “Band name already being used”;
68 require(‘bands2.php’);
69 exit();
70 }
[/code]

Parse error: parse error, unexpected T_VARIABLE in /homepages/2/d135206688/htdocs/whitetrashrecords.com/insertinfobands.php on line 65

tried things a few differnt ways with no luck
any suggestions are always welcome and i hope helpfull
thanks
mikefly

to post a comment
PHP

12 Comments(s)

Copy linkTweet thisAlerts:
@GarySJul 05.2006 — Both lines 64 and 65 need a semicolon at the end.
Copy linkTweet thisAlerts:
@mikeflyauthorJul 05.2006 — ok that stoped the error but now i cant insert anything in to the DB even if its a new band name it still sends me to the bands2.php page

grrrrrr
Copy linkTweet thisAlerts:
@NogDogJul 05.2006 — [code=php]
if(mysql_num_rows($result) >= 1) {
[/code]

($result by itself will just be a resource ID without any intrinsic meaning.)
Copy linkTweet thisAlerts:
@mikeflyauthorJul 05.2006 — well were getting closer here!

well that lets new names thru and doesnt overwrite the DB tables or change the directories on the server. but it doesnt let you know that the name is being used it just continues thru the rest of the script as if the name was ok to use...i hope this makes sense

btw nog i went to your site like it and from one musican to another(bass and guitar here) why dont you play much anymore??
Copy linkTweet thisAlerts:
@NogDogJul 05.2006 — Because there just aren't that many opportunities for mediocre trumpet players, at least not where I can play the types of music that don't bore me to sleep. (I mean, I'm not bad, but compared to the top pros I'm mediocre. ? )
Copy linkTweet thisAlerts:
@mikeflyauthorJul 05.2006 — mmm maybe i should code more and play less??? no cant do it lol!!

well im a grave yard worker so im off to bed, hopefully there will be some awnsers when i get up tonight, i want to get this site up and running by this weekend!! yea right

ttyl
Copy linkTweet thisAlerts:
@aussie_girlJul 05.2006 — Try this..

[code=php]$query = "SELECT bandname FROM bands Where name='$bandname'";
$result = mysql_query ($query)

if(mysql_num_rows($result) == 0)//Bandname available
{
require('bands2.php');

$query = INSERT INTO tablename etc
$result = etc

if (mysql_affected_rows() == 1) // Info was entered into database
{
echo Thanks for entering you band
exit();
}
else{
echo "Band name already being used";
}
}[/code]
Copy linkTweet thisAlerts:
@mikeflyauthorJul 08.2006 — OMG so close here Thanks aussie girl you were very very close i had to make a few small changes in you code. but now even if the name is avalable it still gives bands2.php
[code=php] //Check that user directory is avaliable
$query = "SELECT bandname FROM bands Where name='$bandname'";
$result = mysql_query ($query);

if (mysql_num_rows($result) <= 1)//Bandname available
{
require('bands2.php');
}

//inserts user info into DB
mysql_query ("INSERT INTO bands(bandname,password,emailaddy,bio,genre,shows,photo,songurl)
values ('$bandname','$password','$emailaddy','$bio','$genre','$shows','$pic','$music')");

if (mysql_affected_rows() == 1) // Info was entered into database
{
echo "Thanks for entering you band";


}
else{
echo "Band name already being used";
exit();
}
[/code]
Copy linkTweet thisAlerts:
@aussie_girlJul 08.2006 — if (mysql_num_rows($result) <= 1)//Bandname available

{

require('bands2.php');

}

It can't be equal or less that one, that would mean that there is already a band with that name already there it must be 0 so that there is no match to that band name...that's why it's giving the bands2.php script..Then when the data has successfully added the details the thank you message and then exit() the script..

Why would you have the exit and the end of the script?
Copy linkTweet thisAlerts:
@mikeflyauthorJul 08.2006 — Sorry AG but i put it all back together the way you posted it and it doesnt work. I mean it checks the DB makes sure there isnt already a band name there = to the one being created, if there is one its works fine sending you to the band name already used and bands2.php.

its when there isnt one that i have problems, i get Thanks for entering your band , the bands2.php. it does enter the info into the DB but does not let the rest of the script finish there is still 105 more lines of code to the script ie creating directories and moving uploaded media which all work fine if i use what you gave me the way i changed it, only i still get bands2.php
Copy linkTweet thisAlerts:
@aussie_girlJul 09.2006 — Well then what about this.. if I'm reading your last post correctly, you don't want the band2.php to come up if they have chosen a name for their band that's unique..is that right?

[code=php]$query = "SELECT bandname FROM bands Where name='$bandname'";
$result = mysql_query ($query)

if(mysql_num_rows($result) == 0)//Bandname available
{
$query = INSERT INTO tablename etc
$result = etc

if (mysql_affected_rows() == 1) // Info was entered into database
{
//The rest of your script goes in here instead of thanking them
exit();
}
else{
include('bands2.php'); // Brings up the bands already used?
echo "Band name already being used";
}
}
[/code]
Copy linkTweet thisAlerts:
@mikeflyauthorJul 11.2006 — Thank you for being patient with me AG it works like a charm now thanks again
×

Success!

Help @mikefly spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...