Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 01-31-2017, 09:52 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 133,075
Abronsyth is on a distinguished road
Default Help with Modification Issues

Hey all, me again!

I am working on a riddle system that will quickly allow admins to create riddles, activate one at a time, and then users can answer them and get a reward once each (per riddle).

However I am getting the most obnoxious error:
Parse error: syntax error, unexpected '=' in /home/inekelmy/public_html/view/riddleview.php on line 29

Here is the code it's referring to:
PHP Code:
            $id $mysidia->db->select("riddle", array("id"), ("name" $mysidia->input->post("currname")))->fetchColumn();
            
$clue $mysidia->db->select("riddle", array("clue"), ("name" $mysidia->input->post("currname")))->fetchColumn();
            
$solve $mysidia->db->select("riddle", array("solve"), ("name" $mysidia->input->post("currname")))->fetchColumn(); 
Does anyone see where I'm messing things up?
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #2  
Old 01-31-2017, 11:10 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 20,896
IntoRain is on a distinguished road
Default

The entire "where" part of the query has to be inside the quotation marks. Also, you can fetch everything at once rather than making multiple calls to the database

PHP Code:
$riddle $mysidia->db->select("riddle", array("id""clue""solve"), "name = '{$mysidia->input->post('currname')}'")->fetchObject();

$id $riddle->id;
$clue $riddle->clue;
$solve $riddle->solve
__________________


asp.net stole my soul.
Reply With Quote
  #3  
Old 02-01-2017, 09:45 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 133,075
Abronsyth is on a distinguished road
Default

Aaaah! Right!

Thank you so much!
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #4  
Old 02-01-2017, 10:55 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 133,075
Abronsyth is on a distinguished road
Default

OK one more problem.

It's this chunk of code;

PHP Code:
$done $mysidia->db->select("solved_riddles", array("name""uid"), "name = '{$active}'""uid = '$mysidia->user->uid'")->fetchColumn();
    if(
$done){...}
        else{...} 
It is not doing what it is supposed to do. It is showing me the if{} content regardless of whether the uid+name are added to the table or not. The code simply adds a new row whenever someone solves a riddle, it records the riddle name and the user ID. This part is fully functioning.

The if{} statement is supposed to make it so that users who have solved see the if{} content, and users who have not see the else{} content.

If someone could point out my error here I'd be mighty thankful...and then I could run through some more tests and release the damn thing as a mod
__________________
My Mods Site (1.3.4, 2020 Mods)

Last edited by Abronsyth; 02-01-2017 at 11:43 AM.
Reply With Quote
  #5  
Old 02-01-2017, 01:36 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 20,896
IntoRain is on a distinguished road
Default

I think the problem is with the syntax. Instead of

PHP Code:
"name = '{$active}'""uid = '$mysidia->user->uid'")->fetchColumn(); 
Try

PHP Code:
"name = '{$active}' and uid = '{$mysidia->user->uid}'")->fetchObject(); 
__________________


asp.net stole my soul.
Reply With Quote
  #6  
Old 02-01-2017, 08:29 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 133,075
Abronsyth is on a distinguished road
Default

That seems to have done the trick, thank you!
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 11:08 AM.

Currently Active Users: 711 (0 members and 711 guests)
Threads: 4,081, Posts: 32,031, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636