Jump to content

chico1st

Members
  • Posts

    60
  • Joined

  • Last visited

    Never

Posts posted by chico1st

  1. acutally this is in C so here is my code:

     

    for (i=1; i<= 128000; i++){
    	strcpy(query, "INSERT INTO StartData (INDEX1) VALUES (");
    	ltoa (i,query2,10);
    	strcat(query, query2);
    	strcat(query, ")");
    	if (mysql_query(conn, query)) {
    		fprintf(stderr, "%s\n", mysql_error(conn));
    		exit(0);
    	}
    }

  2. i have to create a table and i have to create an index for it, truncate the table, index it...

     

    its rather slow because i have 128000000 rows

     

    is there a faster way than to go :

    INSERT INTO StartData (INDEX1) VALUES (i)

    128000000 times?

    *i being a counter*

     

     

  3. what is the sql command to do auto index?

    i have an index column and i need to fill it with numbers from  1-128 000 000

    i cant find anything on mysql.com

     

    also can i quickly empty a lot of values out of a table but leave the index column?

    or should i re auto index it once i empty out my table?

     

    i know i can delete from table but would emptying the table and re-indexing it be quicker?

     

  4. Hi I am having an issue with a database I have that holds pictures

     

    I just read pictures in as long blobs and a table in MySQL holds them

     

    but I have just run into a FATAL ERROR

     

    Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 1736612 bytes) in D:\wamp\phpmyadmin\libraries\common.lib.php on line 2418

     

    Can I increase this size? or do I have to change teh entire way that I hold pictures.

     

     

  5. Okay I havent touched phpMySQL in a long time but I loaded up a previous site that I made to make an adjustment. But im getting this error

     

    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ccem'@'localhost' (using password: YES) in D:\wamp\www\Lib.php on line 31

     

    problem connecting to database...

     

    Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'ODBC'@'localhost' (using password: NO) in D:\wamp\www\Lib.php on line 38

     

    Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in D:\wamp\www\Lib.php on line 38

    Access denied for user 'ODBC'@'localhost' (using password: NO)

     

    What am I doing wrong? How do I check what password im supposed to by using?

  6.  

    I cant import my database, it is 2.3MB but my phpmyadmin wont let me import anything larger than 2MB. Is there any way that I can change this?

     

    This is the error that I get when I attempt to import.

    Error

    No data was received to import. Either no file name was submitted, or the file size exceeded the maximum size permitted by your PHP configuration. See FAQ 1.16.

     

     

     

    Im using

    Apache 2.2.4

    PHP 5.2.1 + PECL

    SQLitemanager

    MySQL 5.0.27

    Phpmyadmin

     

     

    Thank you very much for your time.

  7. i get this error when i make an index table in phpmyadmin:
    "PRIMARY" must be the name of and only of a primary key!

    does this mean anything to you

    this was the sql to create my index table
    CREATE FULLTEXT INDEX full_index ON news(
      name ,
      abstract ,
      coresearch
      );

    any idea what it means?
  8. ive noticed that i can make more than one index. the one that the search seems to default to is 'full_index' can i make more than one index then just point my search at different index's?

    also i eliminated  the text area and just left the title, abstract,... 4 fields in total... it officially doesnt work.. but there is no error

    here is the query:
    $sql = "SELECT research.researchID, research.name AS research, research.coresearch, research.affiliation, research.abstract,
    research.fulltext, date.name AS date, author.name AS author,
                  MATCH(research.name, research.abstract, research.coresearch, research.affiliation)
                  AGAINST ('$searchstring') AS score FROM research, date, author
                  WHERE MATCH(research.name, research.abstract, research.coresearch, research.affiliation)
                  AGAINST ('$searchstring')
      AND date.dateID = research.dateID AND author.authorID = research.authorID
      ORDER BY score DESC";
    this is what its searching:
     
    research name: More crazy research
    abstract: The plague is bad
    co-researcher: botton
    affiliation: school

    it has 9 words to search and if i type in any of them it wont find the article.. are all the words occuring too often?
  9. okay i have a full text search, it works, and here is the query
    $query = "SELECT news.newsID, news.name AS news, news.abstract, news.fulltext, date.name AS date, author.name AS author,
                  MATCH(news.name, news.abstract, news.fulltext)
                  AGAINST ('$searchstring') AS score FROM news, date, author
                  WHERE MATCH(news.name, news.abstract, news.fulltext)
                  AGAINST ('$searchstring')
      AND date.dateID = news.dateID AND author.authorID = news.authorID
      ORDER BY score DESC";

    but even if i know a certain word is in the entry im searching, often i wont get any articles coming up as results.

    Is there anything that might cause this like the 50% threshhold? or blocked words?

    for instance if I search 'database' i get a result, yet right next to it is the word 'available' but if i type that in there are no results

    Any idea why?

    ALSO!  if i want to make a certain field more sensitive would I have to make it its own table.. like a title table? or can i just choose to search that field? i know i have to have the same fields in my select as are in my index table so i cant just not include a field as far as i know



    THANKS!
  10. if i change from innoDB to myIsam what will change? will I have to modify my code?

    ive looked into replication and i dont think i want to deal with that

    the speed of my inserts/updates really doesnt matter to me because i have very low traffic but i keep
    hearing the word reliable thrown around, which is important.. i dont want my db's dieing on me.

    however i feel like reliability means something different in the database
    world.. just because that seems to be the trend :P
  11. I have all innoDB tables but i need to do a fulltext search, I have search and read a lot but all of them need a FULLTEXT INDEX which i would create by going like this:

    CREATE FULLTEXT INDEX full_index ON `news`(
      `name` ,
      `abstract` ,
      `fulltext`
      );

    but i get this error: 'The used table type doesn't support FULLTEXT indexes '

    is there an innoDB equivalent or have I destroyed all my chances of searching?
    THANKS FOR ALL THE HELP!
  12. this works but can i make this where command less.. gigantic?

    <?php

    //add a where condition of a certain author/topic/both
    [b]if($postAuthor = $_POST['author']){
    if($postTopic = $_POST['topic']){
    $where = "AND news.authorID = '$postAuthor' AND news.topicID = '$postTopic'";
    }else{
    $where = "AND news.authorID = '$postAuthor'";
    }
    }else{
    if($postTopic = $_POST['topic']){
    $where = "AND news.topicID = '$postTopic'";
    }else{
    $where = "";
    }
    }[/b]

    //add an ORDER BY condition of author/date/topic
    if($_POST['sort'] == 'author'){
    $sort = "author,";
    }elseif($_POST['sort'] == 'topic'){
    $sort = "topic,";
    }


    $query = "SELECT news.newsID,  news.name AS newsName, news.abstract, " .
    "date.name AS date, topic.name AS topic, author.name AS author " .
            "FROM news, date, topic, author " .
            [b]"WHERE news.authorID = author.authorID AND topic.topicID = news.topicID AND news.dateID = date.dateID $where " .[/b]
    "ORDER BY $sort date";

    $result = mysql_query($query) or die($query."<br />\n".mysql_error());

    if(mysql_num_rows($result) == 0){
    $output = "Database is empty <br>";
    }else{
    $output = "<table>";
    while($row = mysql_fetch_assoc($result)){
    $newsid = $row['newsID'];
    $title = $row['newsName'];
    $abstract = $row['abstract'];
    $date = $row['date'];
    $topic = $row['topic'];
    $author = $row['author'];

    $output .= "<tr><td>";
    $output .= "<a href='news_article.php?id=$newsid'>$title</a><br>";
    $output .= "<em>$abstract</em></td>";
    $output .= "<td>$topic</td>";
    $output .= "<td>$author</td>";
    $output .= "<td>$date</td>";
    $output .= "</tr>";
    }
    $output .= "</table>";
    }
    print $output;
      ?>
×
×
  • 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.