Jump to content

Would I need a MqSQL database, in order for my site to have members?


joxley1990

Recommended Posts

Hi guys, just joined because I have a question regarding PHP and MySQL databases. I want to make a website in which members can upload their own photo shopped work, and coded programs.

 

But, to have a feature where members can join, and upload their own work, would I have to have some sort of database, because my server does not support databases, is there any way to do this without MySQL..

 

Thanks, James.

Link to comment
Share on other sites

you can use flat files, but storing user information is always risky in flat files (and a challenge) alternativly you can probably get databasing somewhere else and if your host doesn't offer mysql find a better one cause most php host (almost all) give you mysql with it and its extremly cheap  (<10$ a month)

Link to comment
Share on other sites

What version of php does your server support? PHP5 comes standard with the sqlite database and extension. It would be worth checking anyway.

 

Create a test script....

 

<?php

  phpinfo();

?>

 

Do you see any mention of sqlite?

Link to comment
Share on other sites

try seeing if you can find a mysql only host somewhere else (don't know of one off hand sorry) but make sure your host allows you to first access databases not stored in their systems.  Many times you can but just make sure before you commit.  Users are always best in mysql because other wise you have to do a lot more work in querying flatfiles and its extremely slow.  Not saying it can't be done but the structure of php would force your query to be more like a hide and seek match than a point and find (so to speak).  If you go flat file you have to first come up with a delimeter system (most likely tabs and break lines) and then on every login read the file (the whole file...) break it apart into each row then into each field and find a match in the same line for password and username (a pain...) instead mysql can check logins on a simple 1 query

This is the mysql version:

<?php
$q = "select field from table WHERE Username = $username && Password = $password";
$result = mysql_query($q) or die (mysql_error());
if(mysql_num_rows($result) >0)
{//A match was found register sessions etc etc
}
else
{//Not a valid login
}
?>

This is flat file:

<?php
$file = fopen($users, r);
$rows=  explode("\n",$file);
foreach($rows as $value)
{
$temp = explode("\t", $value);
if ($username == $temp[1] && $password == $temp[2])
{ $userrow = $temp[0]; //ID
  $match = "yes";
  break;
}
}
if($match == "yes")
{//login register sessions etc etc know its ID number thus you know its row number}

Link to comment
Share on other sites

Hi guys, just joined because I have a question regarding PHP and MySQL databases. I want to make a website in which members can upload their own photo shopped work, and coded programs.

 

But, to have a feature where members can join, and upload their own work, would I have to have some sort of database, because my server does not support databases, is there any way to do this without MySQL..

 

Thanks, James.

 

Email me i have a web hosting company.  Its in the US but I will consider giving you a database reference you can use.  I just need information on the business like name and type and all that jazz.  Let me know.  Email prcollin@gmail.com

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.