FUDforum - خوراک RDF
http://fudforum.org/forum/index.php
MYSQL PHP Query Not Working
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=185483&th=123467#msg_185483
{"status":"deleted"} is outputted but the record is not deleted.
If I copy and paste the query into phpmyadmin and run it with the values hard coded it works.
No errors are returned.
The user has privileges to delete and everything else.
Is there anyway I can check it? or see any errors any other way?]]>cuteywithlove2014-04-03T15:46:39-00:00Re: MYSQL PHP Query Not Working
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=185484&th=123467#msg_185484
cuteywithlove@gmail.com <cuteywithlove@gmail.com> wrote:
> I've spent hours on this and can't understand why this doesn't work.
>
> [snip]
> $blog_id = filter_input(INPUT_GET, 'blogId', FILTER_SANITIZE_NUMBER_INT);
> [snip]
> if (!$stmt->bind_param("ii", $id, $blog_Id)) {
> [snip]
>
> If I copy and paste the query into phpmyadmin and run it with the values
> hard coded it works.
>
> No errors are returned.
>
> The user has privileges to delete and everything else.
>
> Is there anyway I can check it? or see any errors any other way?
The first thing I see wrong is that you mistyped "$blog_id" as
"$blog_Id".
--
Blah blah bleh...
GCS/CM d(-)@>-- s+:- !a C++$ UBL++++$ L+$ W+++$ w M++ Y++ b++]]>Salvatore2014-04-03T16:18:51-00:00Re: MYSQL PHP Query Not Working
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=185485&th=123467#msg_185485
> On 2014-04-03, cuteywithlove@gmail.com <cuteywithlove@gmail.com> wrote:
>> I've spent hours on this and can't understand why this doesn't work.
>>
>> [snip]
>> $blog_id = filter_input(INPUT_GET, 'blogId', FILTER_SANITIZE_NUMBER_INT);
>> [snip]
>> if (!$stmt->bind_param("ii", $id, $blog_Id)) {
>> [snip]
>>
>> If I copy and paste the query into phpmyadmin and run it with the values
>> hard coded it works.
>>
>> No errors are returned.
>>
>> The user has privileges to delete and everything else.
>>
>> Is there anyway I can check it? or see any errors any other way?
>
> The first thing I see wrong is that you mistyped "$blog_id" as
> "$blog_Id".
>
Good eye, Salvatore! Can I get you to proof my next project? :)
I would also mention that enabling E_NOTICE would have shown this error
(assuming, of course, the OP doesn't also have $blog_Id defined, of course).
--
==================
Remove the "x" from my email address
Jerry Stuckle jstucklex@attglobal.net
==================]]>Jerry Stuckle2014-04-03T17:08:17-00:00Re: MYSQL PHP Query Not Working
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=185486&th=123467#msg_185486
> On 2014-04-03, cuteywithlove@gmail.com <cuteywithlove@gmail.com> wrote:
>> I've spent hours on this and can't understand why this doesn't work.
>>
>> [snip]
>> $blog_id = filter_input(INPUT_GET, 'blogId', FILTER_SANITIZE_NUMBER_INT);
>> [snip]
>> if (!$stmt->bind_param("ii", $id, $blog_Id)) {
>> [snip]
>>
>> If I copy and paste the query into phpmyadmin and run it with the values
>> hard coded it works.
>>
>> No errors are returned.
>>
>> The user has privileges to delete and everything else.
>>
>> Is there anyway I can check it? or see any errors any other way?
>
> The first thing I see wrong is that you mistyped "$blog_id" as
> "$blog_Id".
>
Mysql may or may not be case sensitive.
He says it works in phpmyadmin
IF its running under apache Id suggests looking at Apache error logs cos
that's typically where errors get reported. There are certainly classes
of errors that don't get reported by the upper layers of the software
that reveal themselves as errors at the base level. A typical one is
trying to process a single result on the implicit assumption that there
is any result at all.
My guess is the statement is executing correctly but not doing anything.
First test: log in as EXACTLY the same user and password under
phpmyadmin and see if it still works.
spent several hours poring over code before I realised that I hadn't
granted select rights on a table to the appropriate mysql user..
In this case does the user have delete rights to the table?
And would that throw and errors at the mysql level? Or simply return a
null result?
--
Ineptocracy
(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.]]>The Natural Philosoph2014-04-03T17:30:02-00:00Re: MYSQL PHP Query Not Working
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=185487&th=123467#msg_185487
> On 03/04/14 17:18, Salvatore wrote:
>> On 2014-04-03, cuteywithlove@gmail.com <cuteywithlove@gmail.com> wrote:
>>> I've spent hours on this and can't understand why this doesn't work.
>>>
>>> [snip]
>>> $blog_id = filter_input(INPUT_GET, 'blogId',
>>> FILTER_SANITIZE_NUMBER_INT);
>>> [snip]
>>> if (!$stmt->bind_param("ii", $id, $blog_Id)) {
>>> [snip]
>>>
>>> If I copy and paste the query into phpmyadmin and run it with the values
>>> hard coded it works.
>>>
>>> No errors are returned.
>>>
>>> The user has privileges to delete and everything else.
>>>
>>> Is there anyway I can check it? or see any errors any other way?
>>
>> The first thing I see wrong is that you mistyped "$blog_id" as
>> "$blog_Id".
>>
> Mysql may or may not be case sensitive.
>
> He says it works in phpmyadmin
>
> IF its running under apache Id suggests looking at Apache error logs cos
> that's typically where errors get reported. There are certainly classes
> of errors that don't get reported by the upper layers of the software
> that reveal themselves as errors at the base level. A typical one is
> trying to process a single result on the implicit assumption that there
> is any result at all.
>
>
> My guess is the statement is executing correctly but not doing anything.
>
> First test: log in as EXACTLY the same user and password under
> phpmyadmin and see if it still works.
>
> spent several hours poring over code before I realised that I hadn't
> granted select rights on a table to the appropriate mysql user..
>
> In this case does the user have delete rights to the table?
>
> And would that throw and errors at the mysql level? Or simply return a
> null result?
>
>
Your guess is wrong. And it has nothing to do with whether MySQL is
case-sensitive or not. $blog_Id is a PHP variable.
--
==================
Remove the "x" from my email address
Jerry Stuckle jstucklex@attglobal.net
==================]]>Jerry Stuckle2014-04-03T18:38:51-00:00Re: MYSQL PHP Query Not Working
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=185491&th=123467#msg_185491
That was the issue now fixed after about 10 hours of debugging, yes it was one letter wrong!!!! :D]]>cuteywithlove2014-04-04T07:48:33-00:00Re: MYSQL PHP Query Not Working
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=185492&th=123467#msg_185492
cuteywithlove@gmail.com wrote:
> Thank you!!!!!!!!!!!!!!!!!!!!!!
>
> That was the issue now fixed after about 10 hours of debugging, yes it was one letter wrong!!!! :D
>
When you find yourself in a situation where you are pretty something
must work, but it doesn't:
1) Make sure you see all errors/warnings/notices. (Fixes 99% of the
problems for me)
2) Delete the code, and retype it! ;-)
Seriously, that helped me out a few times.
And a big HI! to all in comp.lang.php, my favorite newsgroup I have been
neglecting now for waaay too long.
Regards,
Erwin Moller
--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens]]>Erwin Moller2014-04-04T10:28:27-00:00Re: MYSQL PHP Query Not Working
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=185493&th=123467#msg_185493
cuteywithlove@gmail.com wrote:
> Thank you!!!!!!!!!!!!!!!!!!!!!!
>
> That was the issue now fixed after about 10 hours of debugging, yes it was one letter wrong!!!! :D
>
I can't even count the number of times I have missed 1 letter
misspellings (usually an unexpected capital letter).
bill]]>bill2014-04-04T10:45:59-00:00Re: MYSQL PHP Query Not Working
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=185500&th=123467#msg_185500
> On 4/4/2014 3:48 AM, cuteywithlove@gmail.com wrote:
>> Thank you!!!!!!!!!!!!!!!!!!!!!!
>>
>> That was the issue now fixed after about 10 hours of debugging, yes it was one
>> letter wrong!!!! :D
>>
>
> I can't even count the number of times I have missed 1 letter misspellings (usually
> an unexpected capital letter).
>
> bill
I sometimes search the variable name throughout the code to find typos. Some editors
(kate) highlight all occurences of a variable if you click on it, it helps a lot.