Open sami313 opened 9 years ago
<?php
function data_setting_vlaue($dbc, $id){
$q = "SELECT * FROM settings WHERE id = '$id'";
$r = mysqli_query($dbc, $q);
$data = mysqli_fetch_assoc($r);
return $data['value'];
}
function data_page($dbc, $id){
$q = "SELECT * FROM pages WHERE id=$id";
$r = mysqli_query($dbc, $q);
$data = mysqli_fetch_assoc($r);
$data['body_nohtml'] =strip_tags($data['body']);
if($data['body'] == $data['body_nohtml']){
$data['body_formatted'] = '<p>'.$data['body'].'</p>';
}else{
$data['body_formatted'] =$data['body'];
}
return $data;
}
?>
function data_page is working fine ...as i wore the function data_setting_value it throught that error please help me :)
Is that a typo in function data_setting_vlaue($dbc, $id){}
On Sat, Mar 21, 2015 at 11:39 AM, sami313 notifications@github.com wrote:
function data_page is working fine ...as i wore the function data_setting_value it throught that error please help me :)
— Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/112#issuecomment-84408113 .
ohhh sorry i got it thanks alot for helping out God bless you
function data_setting_value($dbc, $id){
$q = "SELECT * FROM settings WHERE id = '$id'";
$r = mysqli_query($dbc, $q);
$data = mysqli_fetch_assoc($r);
return $data['value'];
} //function call in site page
$debug = data_setting_value($dbc, 'debug-status');
i am still getting that error Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\series\dynamic\AtomCMS\functions\data.php on line 8
please I would be gratefull if you read this when placing code so I can help you better -link-
now I need you to check if you actually have a table named settings
and that your table has a colum with the id equals to debug-status
yah sorry i will try to place the code that way i am new to github i will try to fallow the instructions
i took the screen shot i hope it will help you to have a nice look thanks for your support :)
I have found no error on that code... are you sure that it's the code where line 8 is?
You could try with my prepared statements query, I know they work for me so.. maybe I couldn't see the error and using this code will fix it.
Code:
function data_setting_value($dbc, $id){
$stmt = $dbc->query("SELECT * FROM settings WHERE id = '$id'");
$data = $stmt->fetch_assoc();
return $data['value'];
}
yah i am pretty sure should i delete that table and make it again ?
function data_setting_value($dbc, $id){
$q = "SELECT * FROM settings WHERE id=$id";
$r = mysqli_query($dbc, $q) or die(mysql_error());
$data = mysqli_fetch_assoc($r);
return $data['value'];
}
function data_setting_value($dbc, $id){
$stmt = $dbc->query("SELECT * FROM settings WHERE id = '$id'");
$data = $stmt->fetch_assoc();
return $data['value'];
}
the sql comand is what's inside the query.
I'm sorry i guess your php version does not support prepared statements.
this is the sql comand: "SELECT * FROM settings WHERE id = (place any id)"
ok i will try to look in update phpversion
hey you had to change the (place any id) for an existing id like:
SELECT * FROM settings WHERE id = 'debug-status'
*i am sorry i think i might have gone goofy .. i didnt understand...i had put id = debug-status
Also i don't recoment you update the php version.... the problem is just why it's not working the code. I'll come back in like an ahour because i have to go now, but in the meanwile i'll try to figure out this problem.
thanks for you great support me to i am also banging my head in the problem :+1:
to use mysqli_erorr you have to put the $dbc inside.... example:
$r = mysqli_query($dbc, $q) or die(mysql_error($dbc));
I guess to help you in this case i'll need the files. Could you please add them (the site) to like dropbox or something and share it with me.. my email is creptor@live.com
i had made the table again with name set but same problem i almost pulled my half hairs of my head lol yah thats really supportive of you i am just gone send you the code
I got it, when I arrive home i'll look it for any errors
hey I just noticed that in the files you gave me the function has this in is query: $q = "SELECT * FROM set WHERE id = '$id'"
and not this: $q = "SELECT * FROM settings WHERE id = '$id'"
... look it up please
i did that intentionly because i drop the settings table and make it as set so i thought it might work
hello any body there
I was on school, I just came back :cry:
I'll try to recreate your error to see what's not working....
hey this works perfectly, the code is not the problem... it should work, I have try to recreated but it just don't send errors(the same code, can't get your error :cry:)
code:
function data_setting_value($dbc, $id){
$q = "SELECT * FROM settings WHERE id = '$id'";
$r = mysqli_query($dbc, $q);
$data = mysqli_fetch_assoc($r);
return $data['value'];
}
check your $debug, it should be like this:
$debug = data_setting_value($dbc, 'debug_status');
i feel there is something wrong with my database i wonder what have gone wrong so far in code i dont even my self find any error and you have a look as well
In the screenshot you provided, It looks like there is a extra space included on the name of your settings table. Take a look: ' settings'
i even drop the table settings and made a new one with name set but my error is still the same :(
What does your setup.php look like? Do you have a line that looks something like this?
$debug = data_setting_value($dbc, 'debug-status');
I dont see anything wrong with that file, but I would remove that comment off github because it's showing your database information.
On Thu, Mar 26, 2015 at 10:01 AM, sami313 notifications@github.com wrote:
[image: untitled] https://cloud.githubusercontent.com/assets/11160392/6850471/3879f64c-d3fb-11e4-9573-85165d3d7877.png
— Reply to this email directly or view it on GitHub https://github.com/thedigicraft/Atom.CMS/issues/112#issuecomment-86591045 .
yah i will remove it as well point was that to figure the problem
can any of you guy can look remotely into my problem ?
to look remotelly you have to be connected when whe're but be carefull I'll not harm in any way your computer but do not give your ip to any stranger(facebook, youtube, etc)
PD: Don't post your ip!
@JasonMate you're right.... It seems the table that you have created has spaces inside of the name! that's why is not working, nice catch.
that settting table i have drop that long ago i made that with set name i thought that if i had some problem there i might get rid of it and make new table with set name @creptor can you please tell me which software you use to connect so i can install it ..i heard about teamviewer if you have any other option please tell me
i use the web software preinstalled with xampp or wamp wich is php my admin :3 - and sql,but it's basically the same thing.
*its my bed time ..please leave any link regarding remote connection or i guess can even use windows remote connection
to continue this with remote connection email me at creptor@live.com (time: UTC−03:00) with your ip, and i'll contact you if you have any errors...by mail, so keep your router UP(ON), and your computer and server running.
Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\series\dynamic\AtomCMS\functions\data.php on line 8