PCHomepage
Programmer
I am trying to convert a compiled C Web site project created by someone else into PHP and have much of it working but there are some things about it that I do not understand and am concerned of the worth of converting it.
For example, this block seems to be initializing some values from a MySQL query. I don't know C at all so I'm not sure which query it is using as the script has many:
and this is using the values
but it's not clear to me what it's doing because of the way the script receives data from the form. For example, if I used $variable[0] (in PHP) it would just give me the first letter of the word "itemname" if that were the one submitted, $variable[1] the second letter and so on because $variable contains an array. $variable[k] and any other letter would also give only the first letter of the word.
Any thoughts or am I spinning my wheels here? Thanks.
For example, this block seems to be initializing some values from a MySQL query. I don't know C at all so I'm not sure which query it is using as the script has many:
Code:
MYSQL_RES *result;
MYSQL_ROW row;
int num_fields;
int i,j,k;
unsigned char selected=FALSE;
char sqlstr[BUFSIZ*4];
and this is using the values
Code:
if (variable[0]) {
k=0;
while (variable[k]) {
if(strcmp(variable[k],row[i]) == 0)
selected=TRUE;
else if (strstr(row[i],"itemname"))
selected=TRUE;
k++;
}
}
but it's not clear to me what it's doing because of the way the script receives data from the form. For example, if I used $variable[0] (in PHP) it would just give me the first letter of the word "itemname" if that were the one submitted, $variable[1] the second letter and so on because $variable contains an array. $variable[k] and any other letter would also give only the first letter of the word.
Any thoughts or am I spinning my wheels here? Thanks.