|
Hi
I just have that stupid problem and hoping that you can help me on it.
I try to take specific value (user ID for selected user name) from my database to deal with it.
but it's seems that nothing happen !
the code is:
$query2 = MYSQL_QUERY("SELECT userid FROM users WHERE username LIKE '" . $username . "'") ;
while ($result2 = MYSQL_FETCH_ARRAY($query2)) {
$found2 = '1'; $userid2 = $result2['id']; }
echo $userid2;
|
|
|
|
|
Try changing your query to:
$query2 = MYSQL_QUERY("SELECT userid FROM users WHERE username='$username';") ;
I also think you need to SELECT the username as well, since that is what you are comparing:
$query2 = MYSQL_QUERY("SELECT userid,username FROM users WHERE username='$username';") ;
|
|
|
|
|
I solved my problem
As i write, it's a stupid one :$
I replace this
$userid2 = $result2['id'];
by this one
$userid2 = $result2['userid'];
thanks anyway !!
|
|
|
|
|
I debug sql queries by these methods...
1)
echo the sql to a browser so I can test in the Mysql Query Browser to make sure that all variables are set as expected and the query is good. I also include page, line # and the mysql error message in the die command. So if any query is bad you will know where and what and why (<--most of the time).
example:
$sql = "select uid from users where uname='".$user_name."'";
$rst = mysql_query($sql) or die("<br>PG: ".__FILE__."<br>LN: ".__LINE__."<br>ER: ".mysql_error()."<br>Q: ".$sql."<br>");
Note: I usually do this as a function call inside the die so I can set a value for local debug and a live production messages. This is because the above information should be used for the developer and not something a user should ever see. Users should have a simple error message if you can not recover from the error in code.
2)
if your code crashes out after the mysql_query, then find out what you query is returning...exactly.
example:
<?php
.. other code above
echo "<pre>";
while($row=mysql_fetch_assoc($rst))
{
print_r($row);
}
echo "</pre>";
?>
That should give you more info.
Also keep in mind that if you develope on windows and move to linux you will see some error with the case of table and column names make sure you check that. Windows can be lax on case, while linux is not.
Chris J
www.redash.org
|
|
|
|
|
www.esp.com.cn[^]
=======================
i in the browser type that URL,,,just no abnormal,,but..i in "search engine"click the site,,,it will be jumpother site....i have seen it's source code,but no find out how does it jump? in advance thanks~ - -
"
|
|
|
|
|
Your english is not clear
But read the link[^] it will help you to understand.
your probable question:
When you type the url on address bar it behave normally. but when you click in the link in the page it creates a new window. Why?
|
|
|
|
|
search for html a tag and read up on the target attribute....my guess to what you are asking.
Chris J
www.redash.org
|
|
|
|
|
Hi,
WARNING: ultimate noob!
Let's say if I have this function
void CallMeSunny( void )
{
}
I want to callback to it from a shared library. How do I do that? (I just need something simple that works)
I tried to implement some of the snippets online. But, all were to simplified that I couldn't understand them.
Platform: Linux
Language: C
|
|
|
|
|
Creating a shared library may be an advanced topic for a "noob". You may want to begin with simply including external files, or object code. Either way, here is a good link:
Link
Note: You can include code files as external resources instead of using a library. #include "whatever.c"
|
|
|
|
|
Unfortunately, this doesn't apply to what I need : (((
I will try to explain what I am trying to do better:
void functionA()
{
}
void functionB()
{
}
void functionC()
{
}
void functionSL()
{
}
So, instead of writing three callback functions.
I did the following:
void functionABC()
{
functionA();
functionB();
functionC();
}
Therefore, unfortunately, even if I would create a shared library, and place functionA(), functionB() functionC() inside it, I will still have create Callback functions for the functions that are called from within functionA/B/C() ><
Furthermore, this is not my code. I am trying to add some simple functionality there. I did it on windows, and now I need to test it on Linux. But, I can't seem to get the right syntax for callback functions there.
Any ideas on "Callback functions to a function that is inside an executable?"
Thanx!
|
|
|
|
|
You would need to pass a pointer to the function into the library function that is to make the call back. The chances are that you can rethink your design and make things a lot simpler for yourself by just using variables between your executable and library function.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I appreciate the suggestions. But, for MANY circumstances, I NEED to write it that way. I added some more detail to my post, could you kindly view it?
|
|
|
|
|
Yes, I understood what you are trying to do, which is why I made the comments that I did. However, in order to achieve this you need to pass a function pointer into the function of the shared library, just the same as in Windows.
Define your shared library function something like:
void func(void (*callback)())
{
}
changing the return type and other parameters as necessary. Then you can call your function with a pointer to your callback routine as follows:
func(functionA);
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
which is best linux os for making media server in web browser
|
|
|
|
|
What type of media server? Like a streaming media server? Normally, I prefer Fedora, but Ubuntu is the prefered flavor for Airtime (a streaming media server). Ubuntu would probably be the best as its the most popular.
|
|
|
|
|
SLITAZ is small and tiny (30mb only I used it and added some of my own software stack (node.js) to write a tiny server. :P
Linux From Scratch works if you don't like any OS. Personally if you are doing a media server I would actually start from either slitaz or LFS and build my way up. But thats just me.
|
|
|
|
|
as subject says, i'd like to make ssh connection without specifying an username and let server give me an prompt text like "username:" or "login as:" so that I can type my account by myself.
The default way ssh gave is using the username in env as the account i want to connect in remote server, or I can specify a user in the form "username@host".
I ask this for special use, thanks in advance!
Best Wishes!
|
|
|
|
|
I don't think the SSH protocol allows doing what you want. The connection must be authenticated before the server can output anything to the client terminal.
|
|
|
|
|
Thanks man, but is there any official document talked about this or any statement that exactly identified that so that I can make sure? Any link would be suffice, thanks again.
|
|
|
|
|
It really is not too difficult to do this[^].
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
thanks, happy new year to you!
|
|
|
|
|
|
Thanks for your kind help, and may you have a happy new year!
|
|
|
|
|
Hi I am trying to learn so I started looking for free course's on Programming.
I found one I think might get Me started. But since My work will not be graded by the mit staff I hope to get one of the other members to look at my work and grade it. So that I can use that grade to determine how much more review I need on each part of the process.
I want to learn and am in need of some help. If You are not willing to I will understand.
Thank You in advance
Frazzle the name say's it all
|
|
|
|
|
is there any API or code to update most of social networking from one place, for example: facebook, twitter, linkedin and google+?
Thanks
|
|
|
|